lambda-wkhtmltopdf
lambda-wkhtmltopdf copied to clipboard
Convert HTML to PDF using wkhtmltopdf on AWS Lambda
lambda-wkhtmltopdf
Convert HTML to PDF using wkhtmltopdf on AWS Lambda
Input
{
"data" : "<h1>Claudemiro</h1>",
"filename": "optional filename",
"pagesize": "optional pagesize default: a4"
}
Output
{
"filename": "8rqj9td0pvjf9a4i.pdf"
}
Configuration
- Open
config.jsand setbucketvariable to name of S3 bucket where you want function to save output PDF files. - Make sure AWS Lambda function has
PutObjectaccess to S3 bucket - Download the binary wkhtmltopdf for linux-x64 and put in the current directory
- Run npm install
- Zip everything and upload to aws-lambda
Links
- http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
- http://aws.amazon.com/documentation/apigateway/
- http://wkhtmltopdf.org/
- https://www.npmjs.com/package/wkhtmltopdf
- http://swagger.io/
- https://github.com/ashiina/lambda-local