Skip to content

Kenasvarghese/PDF-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF Generator

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.

Run Locally

Clone the project

  git clone https://github.com/Kenasvarghese/PDF-Generator.git

Go to the project directory

  cd PDF-Generator

Start the server

  go run main.go

NOTE: You can change host, browserURL, template of the service by editting the corresponding file

- Change configuration file

Update values of file ./config/config.json

{
    "port":"8008",
    "basepath":"/v1",
    "browserurl":""
}
- Change PDF template

Update html of file ./pdfgenerator/template.go

- To get browser WS address
  • 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

- To generate PDF
  • 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

About

PDF generation service in Go with HTML template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages