'Can I use wkhtmltopdf on AWS Lambda
I'm using a AWS Lambda function to merge PDF files stored on S3. In addition to that, I need now to create a PDF file (from HTML and CSS). I was trying to use wkhtmltopdf, but it seems that I would have to install it using apt-get install (which I don`t think I have access on AWS Lambda).
Any ideas on how can I do it?
Any suggestions for wkhtmltopdf replacements?
Thanks!
Solution 1:[1]
Include the wkhtmltopdf binary and making sure it has execution permission(chmod 755). Add the binary path to your language runtime. e.g. with nodejs
process.env['PATH'] = process.env['PATH'] + ':' + process.env['LAMBDA_TASK_ROOT'] + '/bin/linux';
Solution 2:[2]
Upload the binary inside a folder of your project for example in a folder "binary /" so that at the time of lambda execution you can call it by reference
Solution 3:[3]
There is a specific download of wkhtmltopdf for use with AWS Lambda.
It is meant to be used as a separately uploaded Layer.
Solution 4:[4]
Important caveat: If you want to use wkhtmltopdf successfully on AWS Lambda, you will need to use v0.12.4.
It turns out that newer versions have some issues with dynamic libraries. If you drill into it, you'll find some .so files missing.
Source: Richard Keller
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Fish |
| Solution 2 | Victor Rojas |
| Solution 3 | pixelistik |
| Solution 4 | haz |
