Greeting,
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!
Because the boto3 module is already available in the AWS Lambda Python runtimes, don't bother including boto3 and its dependency botocore in your Lambda deployment zip file.
Lambda supports Python, which is a great option if you've got experience using it. However, one of the downsides to Lambda is that by default you won't be able to import your trusted packages, like Pandas. I'm going to show you the easiest way of importing any package you need for your Lambda function.
You can configure a function to mount an Amazon Elastic File System (Amazon EFS) file system to a local directory. With Amazon EFS, your function code can access and modify shared resources safely and at high concurrency.
AWS Lambda natively supports Java, Go, PowerShell, Node. js, C#, Python, and Ruby code, and provides a Runtime API which allows you to use any additional programming languages to author your functions. Please read our documentation on using Node. js, Python, Java, Ruby, C#, Go, and PowerShell.
There are multiple projects on GitHub claiming to run wkhtmltopdf on Lambda. Here are a few.
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';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With