Consider this PDF form.
I'd like to fill it using pdftk, as in this question, but preserve the ability to open and edit the form fields in Adobe Reader, as well as preserve the Javascript validation.
Consider the following fdf
file, which we can put in a file called Fill.fdf
.
%FDF-1.2
1 0 obj
<<
/FDF << /Fields 2 0 R>>
>>
endobj
2 0 obj
[<< /T (form1[0]) /V () >>
<< /T (form1[0].#subform[0].P1_Line1_Name[0]) /V (My Name) >>
]
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF
We apply this fdf file to the form using pdftk.
pdftk i-864.pdf fill_form Fill.fdf output Output.pdf
If we then open Output.pdf
in Adobe Reader, we get the following error.
This document enabled extended features in Adobe Acrobat Reader. The document has been changed since it was created and use of extended features is no longer available. Please contact the author for the original version of the document.
I presume that pdftk
broke Adobe's digital signature when it filled the form, which is what causes the error above.
This answer removes that error, but it removes the Javascript inside the original PDF, breaking some of the validation on fields that is run when the file is opened in Adobe Reader.
pdftk Output.pdf cat output SignatureRemoved.pdf
If we open SignatureRemoved.pdf
in Adobe Reader, we can still edit the form fields, but none of the validation on fields (such as constraining which characters are allowed in each field) runs any longer.
Is there a way to either remove the signature without removing the Javascript, or reapply the signature to the result of filling a form with pdftk?
Update: I've also attempted to use qpdf, but it does not remove the signature.