A lot of systems require HTML to be converted to PDF. This module helps you build PDFs for a url through an API. Internally this uses Chrome to render the pages and then convertes them to PDF using the puppeteer.
2. Getting started
git clone https://github.com/Samagra-Development/html-printer
- Setup puppeteer
- Install the dependencies.
- Start the server.
yarn start. This will start a server on the port
3022or if you have specified a
envvariable then it would pick up that.
2.2 Checking the PDFs
To download the PDF for a specific URL open your browser and use the query params as follows http://localhost:3022?/export/pdf?url=https://github.com/
- This speed of the PDF generation is directly proportional to the infra that you set thing and the speed of the site. So sometimes it may take more than 30 seconds to build a PDF.
- There is no queue management on the system. So a lot of requests in a quick succession will lead to a consumption of a lot of memory and can lead to crashes.
Feel free to write into firstname.lastname@example.org in case you have questions, feedback or want to know more!
5. Coming Soon
- Queue to manage multiple requests
- Async API to and webhook implementation