Skip to content

Using Google Puppeteer to convert HTML template to PDF on server

Notifications You must be signed in to change notification settings

Coralxin/html-to-pdf-puppeteer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html-to-pdf-puppeteer

Its has always been a challenge for many developers to generate PDF from html on server side. There are scenarios like where we need to generate a PDF invoice for a customer, save it on server as well as email them the PDF.

I am using a simple HTML invoice template to demonstrate how we can use puppeteer and node js to create a pdf of it on server.

STEPS TO RUN ABOVE CODE

  • First clone the repository using git clone command
  • Run npm install in the project root directory.
  • Wait for dependencies to install, they may take some time depending on your internet speed.
  • Run node index.js command in your terminal.

You will see a file name invoice.pdf in you project root folder, that is the converted file from html to pdf.

About

Using Google Puppeteer to convert HTML template to PDF on server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 74.5%
  • JavaScript 25.5%