A simple and efficient PDF generation app that allows users to generate PDFs dynamically using predefined templates. The app exposes a POST endpoint that accepts a request body with the necessary data and configuration to generate the PDF. The template used for the PDF is customizable within the app.
Clone the project
git clone https://github.com/Kenasvarghese/PDF-Generator.gitGo to the project directory
cd PDF-GeneratorStart the server
go run main.goNOTE: You can change host, browserURL, template of the service by editting the corresponding file
Update values of file ./config/config.json
{
"port":"8008",
"basepath":"/v1",
"browserurl":""
}Update html of file ./pdfgenerator/template.go
-
Close all instances of chrome,
-
Run chrome in remote debugging mode
- On Windows:
chrome.exe --remote-debugging-port=9222
- On macOS/Linux:
google-chrome --remote-debugging-port=9222
-
Navigate to: Remote Debugging Interface
- Send a post request
- Path: /generate
- Method: POST
- Body:
{ "name":"kenas", "email":"[email protected]", "dob":"01/12/2025", "gender":"male" }
- The PDF will be generated in output.pdf