skip to Main Content

I’m on debian 10. I was trying to use pdftk in order to use the generated_fdf command.
When I just

apt-get install pdftk

then

pdftk a.pdf generated_fdf output a.fdf

It output

    Error: Unable to find file.
    Error: Failed to open input PDF file:
        generated_fdf
    Errors encountered.  No output created.

I figured maybe the debian repo is not up to date so I decided to build it from the git repo
then I used :

java -jar /lib/pdftk/build/jar/pdftk.jar  a.pdf generate_fdf output a.fdf

it worked !!!
So in order to have the same code in dev (debian), testing (ubuntu) , prod (Windows) I decided to create a file here usr/bin/pdftk

#!/usr/bin/env sh
echo "pdftk_perso"
ls -l "$1"
whoami
java -jar /lib/pdftk/build/jar/pdftk.jar "$@"

the output is now

pdftk_perso
-rw-r--r-- 1 user user 208557 Sep 22 16:06 a.pdf
user
Error: Unable to find file.
Error: Failed to open input PDF file:
   generated_fdf
Errors encountered.  No output created.
Done.  Input errors, so no output created.

So again it’s not working as if it was trying to find the file named "generated_fdf"

FYI it works fine with windows and ubuntu

2

Answers


  1. You have mistyped pdftk a.pdf generated_fdf output a.fdf as generated_fdf is not a command. The command is generate_fdf to create an fdf file. You have corrected the command by yourself on windows. See the difference in your both commands. Also PDFTK is not giving an error, it is saying that the file was not found, so the command is not right by itself. Run the same command via your debian terminal, it will work

    pdftk "Business model.pdf" generate_fdf output k.fdf

    let me know if you face an issue.

    Login or Signup to reply.
  2. Also i am facing same issue, But from following steps resolved my issue –

    1. sudo ln -s /snap/pdftk/current/usr/bin/pdftk /usr/bin/pdftk
    2. sudo ln -fs /snap/pdftk/current/usr/bin/pdftk /usr/bin/pdftk

    Note: You may need to logout and log back in to reset your session.

    pdftk input.pdf cat output new.pdf

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search