-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using it in AWS Lambda #2
Comments
Hmm - yeah it should run fine in Lambda using the approach in that blog. On inspection, your error message ( The first argument you pass to fillForm() is just a filepath which will be sent verbatim to pdftk, so my guess is that you are perhaps using a relative path, or some kind of location that isn't available to pdftk when it executes. Could you try an absolute path to your file, and see if that works or gives you a different error? |
You can build PDFTK from source on EC2 - AMI image, then bundle the output executable into your AWS Lambda Deployment Package. Alternatively, you could download it here at your own risks: lambda-pdftk-example |
I've gotten this working on Lambda, but yes, it requires building pdftk from the source. You should built it yourself. (not saying https://github.com/lob/lambda-pdftk-example is wrong, but I got different checksums when I built it myself) I used the official Cent OS 6 AMI (on a t2.medium) and followed these instructions
After make is done (no need to install), copy The lambda code to get this working is really easy.
Now you can use pdffiller-stream to do whatever is needed
|
I ran into an issue when using this with AWS lambda functions. The issue is that Lambda is not allowing the package to make a temp_.fdf file in the root.
I try to change the location of the temp file from root to /tmp folder, but its also not working. |
@ImNoumanDilshad this is not related to your dest file, that's an internal temp file that the library creates internally. It's hardcoded in the index.js file. |
Yes, I figured it out. |
@ImNoumanDilshad What did you end up doing to get this to work? |
@archermc this issue can be resolved by using pdf filler's function |
Hi. I am trying to use the module to fill pdf from template in a Lambda function on AWS.
my template is located in /tmp as /tmp/template.pdf. and I verified with fs the file is there. But When I run pdffiller-stream.fillForm( tmpFile, filldata); I am getting an error
pdftk exec error: Error: Unable to find file.
Is this something you can help?
pdftk is loaded as part of my lambda as per this blog
https://lob.com/blog/aws-lambda-pdftk
Thanks.
Colin
The text was updated successfully, but these errors were encountered: