Skip to content
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

Support for pdftk-java #75

Closed
nathanhruby opened this issue Nov 1, 2019 · 6 comments
Closed

Support for pdftk-java #75

nathanhruby opened this issue Nov 1, 2019 · 6 comments

Comments

@nathanhruby
Copy link

Hi,

Debian was (as far as I can tell) the last distro to support libgcj and pdftk. As of Buster they are no longer supporting it

Does pdf-forms work with or support pdftk-java?

@jkraemer
Copy link
Owner

jkraemer commented Nov 2, 2019

I never looked into this, but it seems that a simple wrapper script around the java -jar pdftk-all.jar call (passing on any command line options) which would then be set as the pdftk executable in pdf-forms (PdfForms.new('/path/to/script')) might work.

Please report back if you give this a try, so we can add it to the README.

@pavel-jurasek
Copy link

pavel-jurasek commented Sep 24, 2020

Hi,
it's working just deployed to our platform. java-pdftk works.

Wrapper script:

#!/bin/sh
MYSELF=`which "$0" 2>/dev/null`
[ $? -gt 0 -a -f "$0" ] && MYSELF="./$0"
java=java
if test -n "$JAVA_HOME"; then
    java="$JAVA_HOME/bin/java"
fi
exec "$java" $java_args -jar $MYSELF "$@"
exit 1

how to create wrapper:

cat /bin/stub.sh /pdftk/build/libs/pdftk-all.jar > pdftk.run && chmod +x pdftk.run

Executable JAVA PDFTk

pdftk.run

@jkraemer
Copy link
Owner

thank you! I added this info to the README.

@tfmertz
Copy link

tfmertz commented Jun 18, 2021

Hmm, we were able to get it working without a java wrapper script just by installing the pdftk-java package and passing through that executable to pdf-forms gem. Maybe we just go lucky and our distro had that package? Or the docs are a bit out of date.

Running on ruby:2.6.6 container (Debian Buster)

apt-get update && apt-get install -y pdftk-java
which pdftk
# returns something like /usr/bin/pdftk

In rails code

pdftk = PdfForms.new('/usr/bin/pdftk')

Hope that's helpful, if it's wrong I welcome any corrections or insights :)

@pavel-jurasek
Copy link

Hmm, we were able to get it working without a java wrapper script just by installing the pdftk-java package and passing through that executable to pdf-forms gem. Maybe we just go lucky and our distro had that package? Or the docs are a bit out of date.

Running on ruby:2.6.6 container (Debian Buster)

apt-get update && apt-get install -y pdftk-java
which pdftk
# returns something like /usr/bin/pdftk

In rails code

pdftk = PdfForms.new('/usr/bin/pdftk')

Hope that's helpful, if it's wrong I welcome any corrections or insights :)

Hi, indeed on Debian base operation system it would work, but our platform running on Alpine where pdftk-java is not available..

@mikeappell
Copy link

mikeappell commented Nov 12, 2021

Not sure if this is helpful, but this works for us to install the current latest version of pdftk-java using a native image in a Docker container and use it with pdf-forms.

Most recent binary should be reflected here: https://gitlab.com/pdftk-java/pdftk#pre-built-binaries

RUN wget -O /usr/bin/pdftk "https://gitlab.com/pdftk-java/pdftk/-/jobs/1527259632/artifacts/raw/build/native-image/pdftk" \
    && chmod a+x /usr/bin/pdftk

and then

PdfForms.new('/usr/bin/pdftk')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants