Code Monkey home page Code Monkey logo

lambda-pdf-generator's Introduction

Pdf generator using puppeteer for lambda

This project made specifically for lambda and deploying using SAM. Does following tasks.

  1. Generate pdf for given URL and store in S3.
  2. Compress PDF using ghostscript if needed.
  3. Send SNS notification at the end.

Parameters to pass:

{
"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.

Notes

  • 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 while npm install. You may find it in node_modules\puppeteer\.local-chromium.

How To Run on local

Read Blog

Credits

This project uses and take references from following projects and articles and greatly thankful for their hard work.

  1. puppeteer-lambda-starter-kit
  2. Ghost Script
  3. lambda_s3pdf_compress
  4. serverless-chrome

lambda-pdf-generator's People

Contributors

isummation avatar nstapelbroek avatar

Watchers

Daniel VALIDE avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.