This project made specifically for lambda and deploying using SAM. Does following tasks.
- Generate pdf for given URL and store in S3.
- Compress PDF using ghostscript if needed.
- Send SNS notification at the end.
{
"sourceurl": "[URL needs to print as PDF]",
"pdflocation": "[s3 key location]",
"compress":true,
"sns_arn": "[SNS arn to send notification]"
}
Parameters compress and sns_arn are optional and pass only if needed.
- Change S3 bucket name in template.yaml before executing on
sam local
. - Lambda has certain limitation in terms of timeout (allow maximum 5 minutes) and package size. Please read article AWS Lambda limits for detail.
npm install
will also download chromium for your development OS which may exceed size requirements for lambda. This package already include puppeteer build for amazon linux so you can remove build downloaded whilenpm install
. You may find it innode_modules\puppeteer\.local-chromium
.
Read Blog
This project uses and take references from following projects and articles and greatly thankful for their hard work.