https://github.com/brianpursley/pdfform-lambda
Demonstrates creating a serverless application for populating fillable PDFs, using Node.js, AWS Lambda, AWS API Gateway, AWS CloudWatch, and Terraform
https://github.com/brianpursley/pdfform-lambda
aws-api-gateway aws-cloudwatch aws-lambda node-js pdf terraform
Last synced: about 2 months ago
JSON representation
Demonstrates creating a serverless application for populating fillable PDFs, using Node.js, AWS Lambda, AWS API Gateway, AWS CloudWatch, and Terraform
- Host: GitHub
- URL: https://github.com/brianpursley/pdfform-lambda
- Owner: brianpursley
- License: mit
- Created: 2021-07-17T16:20:40.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-20T18:19:57.000Z (over 4 years ago)
- Last Synced: 2025-03-24T02:37:33.536Z (about 1 year ago)
- Topics: aws-api-gateway, aws-cloudwatch, aws-lambda, node-js, pdf, terraform
- Language: HCL
- Homepage:
- Size: 48.8 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pdfform-lambda
This project demonstrates creating a serverless application for populating fillable PDFs.
## Technologies Used
* Node.js
* AWS Lambda
* AWS API Gateway
* AWS CloudWatch
* Terraform
## Deploying
```
terraform -chdir=tf apply
```
or
```
cd tf
terraform apply
```
## Usage
### Listing the fields of a fillable PDF:
```
curl --request POST \
--url https://11hnc9oxr8.execute-api.us-east-2.amazonaws.com/test/listFields \
--header 'content-type: application/json' \
--data '{"pdf": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"}'
```
Response:
```
{"f1_1":[{"type":"string"}],"f1_2":[{"type":"string"}],"f1_9":[{"type":"string"}],"f1_10":[{"type":"string"}],"c1_1":[{"type":"boolean"},{"type":"boolean"},{"type":"boolean"},{"type":"boolean"},{"type":"boolean"},{"type":"boolean"},{"type":"boolean"}],"f1_3":[{"type":"string"}],"f1_4":[{"type":"string"}],"f1_5":[{"type":"string"}],"f1_6":[{"type":"string"}],"f1_7":[{"type":"string"}],"f1_8":[{"type":"string"}],"f1_11":[{"type":"string"}],"f1_12":[{"type":"string"}],"f1_13":[{"type":"string"}],"f1_14":[{"type":"string"}],"f1_15":[{"type":"string"}]}
```
### Transforming a fillable PDF using field values:
```
curl --request POST \
--url https://11hnc9oxr8.execute-api.us-east-2.amazonaws.com/test/transform \
--header 'content-type: application/json' \
--data '{
"pdf": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
"fields": {
"f1_1": ["FirstName LastName"],
"f1_2": ["CompanyName"],
"c1_1": [1,0,0,0,0,0,0],
"f1_7": ["123 Fake Street"],
"f1_8": ["Cincinnati, OH 45241"],
"f1_14": ["12"],
"f1_15": ["3456789"]
}
}' \
--output /tmp/output.pdf
```
The filled PDF will be written to **/tmp/output.pdf**