troubleshooting Question

PDFTK - filling this PDF but got an error

Avatar of Camillia
CamilliaFlag for United States of America asked on
.NET ProgrammingC#OCR
46 Comments1 Solution461 ViewsLast Modified:
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
   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
   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" 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

I hope there's a way to fix this because iTextSharp is not a good solution for me.
Join our community to see this answer!
Unlock 1 Answer and 46 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 46 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros