A Lambda function that utilises pdf-lib to fill out PDF form fields in an adobe acrobat form, and uses QPDF to correct the PDF output.
- Reads template key & form values from incoming request
- Retrieves template from S3 bucket via template key
- Fills form fields using pdf-lib
- Calls qpdfto correct PDF output
- Returns filled PDF as a base64 encoded string
To run:
yarn install // Install Deps
make local-pdf-service // Start the local serviceTo invoke:
make local-lambda-curl // Invokes the lambda and outputs to `./tmp` as `out****.json`
make b64-to-pdf // Converts lambda output to a PDF `./out/final_****.pdf`To test:
The following command will run the unit tests.
yarn run test:unit testsThe following command will run the unit tests, and then start the app, wait for it to load and run the integration tests.
yarn run test:allIt will also output each PDF template filled in to ./tmp/filled_****.pdf
And the QPDF output will be at ./tmp/fixed_****.pdf
Run make layer-pdflib
Run make layer-qpdf-zip