This project is used to generate PDF from HTML/Text source.
It use Puppeteer library to run a browserless instance of Chrome inside an AWS Lambda function running on Node.Js.
It also use LiquidJs to parse HTML before sending to Puppeteer and and output PDF as result or can simply upload PDF to an AWS S3 Bucket.
This project is deployed on AWS using the framework Serverless with multiple plugins.
Simple example of all the options available to generate/save PDF:
1curl --location --request POST 'http://localhost:3000/local/generate' \
2--header 'Content-Type: application/json' \
3--data-raw '{
4 "content": {
5 "base64": "PGRpdj5kZW1vPC9kaXY+",
6 "html": "<div>demo</div>",
7 "template": "pdf/invoice"
8 },
9 "pdfOptions": {
10 "format": "letter"
11 },
12 "options": {
13 "s3":{
14 "upload": true,
15 "bucket": "simply_pdf",
16 "path": "invoices/1234.pdf"
17 }
18 },
19 "data": {
20 "invoice": {
21 "identifier": "1234"
22 }
23 }
24}'
© 2013-2024 All rights reserved.