First of all, thank you for the time you are taking to read my question.
I have a PDF file with a part that, when you fill it, it populates other parts of the PDF.
Basically, you enter your last name and it populates the parts of the PDF that need the last name.
I need to fill the last name with a PHP script that takes the last name from a HTML form. I need to keep the auto-fill feature enabled.
The field_name for the last name is:
FieldType: Text
FieldName: MCSA-5875[0].Page1[0].driverPersonal[0].nameLast[0]
FieldNameAlt: Enter the driver's last name.
FieldFlags: 0
FieldJustification: Left
The FDF file I created to fill the form is:
%FDF-1.2
%,,oe"
1 0 obj
<<
/FDF << /Fields [<</T(MCSA-5875[0].Page1[0].driverPersonal[0].nameLast[0])/V(Smith)>>"] >> >>
endobj
trailer
<</Root 1 0 R>>
%%EOF;
Where "Smith" is a sample last name.
When I run the following command (to fill the PDF form):
pdftk form.pdf fill_form output.fdf output output.pdf
I get the following error:
Unhandled Java Exception in create_output():
java.lang.ClassCastException: pdftk.com.lowagie.text.pdf.PdfLiteral cannot be cast to pdftk.com.lowagie.text.pdf.PdfDictionary
at 0x0059a84e (Unknown Source)
at 0x0059ad42 (Unknown Source)
at 0x005e9bd4 (Unknown Source)
at 0x005ba4a4 (Unknown Source)
at 0x005b2044 (Unknown Source)
at 0x0059231e (Unknown Source)
at 0x004721bd (Unknown Source)
at 0x00472562 (Unknown Source)
at 0x00472045 (Unknown Source)
at 0x004df3e2 (Unknown Source)
at 0x004df38a (Unknown Source)
at 0x00471e74 (Unknown Source)
Can you help me to find a solution to this problem?
Thanks in advance
Well, I did it! I just used the following open-source solution: https://github.com/Tadelsucht/BulkPDF
We filled the csv template on demand using an HTML form and a PHP backend.
We, then, called the application trough command-line using PHP