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\qpd
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
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" 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
I hope there's a way to fix this because iTextSharp is not a good solution for me.