Skip to content

A serverless function to fill a fillable pdf with json data and store it on S3

Notifications You must be signed in to change notification settings

webtaculars/serverless-pdf-filler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serverless-pdf-filler

A serverless lambda function to fill a fillable pdf with json data and store the resulting pdf on S3.

Pre-requisites

  • AWS account with AWS-CLI configured and access to S3
  • Serverless framework installed
  • Fillable PDF (To create a fillable pdf, try pdfescape)

How to use

  1. Clone the repo and install pdffiller-stream
    npm install --save pdffiller-stream
  1. Add a source fillable pdf in the root directory of the project and change the sourcePDF value to that pdf name.
    const sourcePDF = "test.pdf";
  1. Add the required data to be filled in the pdf.
    const data = {
      "name": "test name",
      "date": "dd/mm/yyyy"
    };

In most cases, this data will be sent in the event object while triggering the lambda.

  1. Update the S3 bucket name and the key of new pdf to be generated.
    const Bucket = "bucket"; // Create a bucket or use an existing one in S3.
    const Key = "key"; // Name of the generated document
  1. Update the aws credentials. Access key and access secret key can be taken from the IAM console.

Test locally

    serverless invoke local —f pdftk

Deploy

    serverless deploy

About

A serverless function to fill a fillable pdf with json data and store it on S3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published