0

I was given a .zip file that had an external library called Python PDF Toolkit, often abbreviated as pdftk or pypdftk.

To my current knowledge, this external dependency was built on a EC2 instance of CentOS6, because the pdftk has its own dependency called libgcj.

enter image description here

As you can see from the image, most of the files are Unix Executable Files, and are missing their file extensions.

  1. Will this create problems in Lambda? I believe the pdftk needs to be uploaded as a Lambda Layer to help extend the standard core Python Library.

  2. If this will create problems executing Lambda, are there any steps I can take to find the file extensions?

Lastly, I can edit this question and add the code within these files if you believe that will help.

WHEEL

Wheel-Version: 1.0
Generator: bdist_wheel (0.35.1)
Root-Is-Purelib: true
Tag: py2-none-any

It looks like this won't work with Py3?

1 Answer 1

1

pypdftk is a wrapper for pdftk binary. So you need 2 things:

  1. Install the pdftk binary as a Lambda Layer. For more details look here.
  2. You also need the python code. It seems that this is only a python file. You can either copy it directly or your code or install it with pip. It should work with python 3.

You have been provided with a wheel package. Chances are that it won't work with lambda and python 3, although it isn't impossible to properly configure everything. It should be easier to install pypdftk and binary dependencies from scratch.

Sign up to request clarification or add additional context in comments.

4 Comments

from the official build guide: pdflabs.com/docs/install-pdftk-on-redhat-or-centos it they suggest using CentOS 6, but this reached End of Life (EOL) in 2020. Should I do this on CentOS6 even if its EOL? or try working with latest releases?
I would first try the pre-built binaries in the github project (github.com/inetsys/pdftk-aws-lambda). Binaries were built in CentOS6. I would then try to build it in Amazon Linux 2. This may be more difficult.
Ok. I was able to build the binaries using GitHub project and upload them as a lambda layer. I will accept your answer, but I am still getting Runtime.ImportModuleError: Unable to import module
Check that everything is uploaded correctly and that the name of your handler is correct. Check stackoverflow.com/questions/35340921/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.