
Creating the AWS Lambda layersĪWS Lambda layers allow us to add in "layers" of dependencies for our functions. You may need to include one of these fonts as a layer in your lambda function (via ARN) if your function has issues in the beginning. Random note: If you need more fonts for future usage, I've found that this is a good resource.
#Pdfkit s3 update
Or, you can click here (I likely won't update this link, so probably best to go directly to the release page).

#Pdfkit s3 zip
You'll see an entry under Amazon Linux with lambda zip as the architecture. You can download the binary on the releases page under the Stable releases.
#Pdfkit s3 archive
"All files required for lambda layer are packed in one zip archive (Amazon Linux 2 / lambda zip)" The wkhtmltopdf site actually lists using this library with AWS Lambda as a FAQ and gives the following response to this question: Putting this binary into an AWS Lambda Layer can help solve this by having a single point of installation and management. This isn't a big deal, but managing this dependency could get tedious if your architecture has multiple servers that need installed with different Linux distributions. When I first installed wkhtmltopdf, I didn't heed the warning and just ran the following:
#Pdfkit s3 install
To use this options you should install static binary from wkhtmltopdf site" " Warning! Version in debian/ubuntu repos have reduced functionality (because it compiled without the wkhtmltopdf QT patches), such as adding outlines, headers, footers, TOC etc. At the top of the installation instructions, you can see the following warning: When I was first using this library, I was also using pdfkit to drive this interaction. For continued instruction, you can skip to the next section.
#Pdfkit s3 pdf
Wkhtmltopdf is an open-source command line tool that enables you to easy convert an HTML file to a PDF file. For those who have used template languages before, you can probably imagine the usefulness of a function like this in combination with Jinja or template rendering engines commonly found in Web Frameworks (like Django).Īfter doing some research on third party libraries that could simplify our goal, I decided to use wkhtmltopdf. This article will use us-east-2 for the AWS region, changing this shouldn't effect functionality, just the links within the article.Ī better way to do this is through AWS Serverless Application Model (SAM), but this is more tailored for those looking for the basic setup through the AWS Management Console.Ī common task I've found myself undertaking recently is programmatically converting an HTML file/string to an embedded and stylized PDF file.Īn example use case for this might be exporting a self-managed customer invoice or generating a daily report from an existing HTML template.

