We help IT Professionals succeed at work.
Get Started

PDFTK - filling this PDF but got an error

Camillia asked
Last Modified: 2017-11-13
I'm hoping there's a solution for this problem.

1. I have the FDF that I want to use to populate a PDF. It's attached. It's i-765.txt

2. I have the PDF file. I got it from the INS site. It's attached here and called i-765.pdf

3. I ran this command
   pdftk.exe i-765.pdf fill_form i-765.txt output Output.pdf

but got this error

Error: Failed to open PDF file:
   OWNER PASSWORD REQUIRED, but not given (or incorrect)
Errors encountered.  No output created.
Done.  Input errors, so no output created.

4. I googled the error and came across this solution saying I need to run qpdf Solution to get rid of the error

    a. I downloaded QPDF from here Download QPDF
    b.  It got installed in folder:  C:\Users\bwa\Downloads\qpdf-7.0.0-bin-mingw32\qpdf-7.0.0\bin
    c. I copied i-765.pdf to that folder
    d. Ran this command
qpdf --decrypt i-765.pdf decrypted765.pdf

Open in new window

   e. Now, I have decrypte765.pdf. I open it and get this message. I click ok on it and the PDF is read-only
        Message I get    f.  I ran this command to get rid of the message
pdftk decryptedi765.pdf cat output i-765notsigned.pdf

Open in new window

   g. I open i765notsigned.pdf and there's no error and the fields are editable.
    However,  I noticed this: The functionality of the i765notsigned.pdf is broken compared to the original i765.pdf. For example, in the "marital" question...you can click on ALL the checkboxes which is wrong. In the original i765.pdf, you can only choose ONE martial checkbox.

  Another example of the broken PDF: in question #15, if you click "Yes", the 3 fields below it should become editable but it doesn't. In the original i765.pdf, if you click "Yes", the 3 fields become enabled.

5. I run this to populate the pdf. It populates it but again, the functionality of the original PDF is broken.
   PDF pdftk.exe i765notsigned.pdf fill_form i-765.txt output OutputFilled.pdf

Open in new window

I hope there's a way to fix this because iTextSharp is not a good solution for me.
Watch Question
Most Valuable Expert 2018
This problem has been solved!
Unlock 1 Answer and 46 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE