when I do pdftk samplex.pdf dump_data_fields
I get back fields with format like:
FieldType: Text
FieldName: form1[0].Page1[0].Header[0].RepeatHeader[0].Project[0]
FieldNameAlt: Project
FieldFlags: 0
FieldJustification: Left
I have a sample that works with pdftk in filling in the fields, but it is a simpler format and the FieldNames are things like 'name'.
I try to merge the following fdf to get my infill for this field (as you can see below I try both the long name and the short name), but it doesn't seem to be working, any ideas on why?:
%FDF-1.2
%âãÏÓ
1 0 obj
<<
/FDF << /Fields [ << /V (Something wonderful!)/T <br/>(form1[0].Page1[0].Header[0].RepeatHeader[0].Project[0]) /ClrF 2 /ClrFf 1 >>
<< /V (Something)/T (Activity) /ClrF 2 /ClrFf 1 >>
<< /V (Something else)/T (Project) /ClrF 2 /ClrFf 1 >>
<< /V (Arthur, King of the Britons)/T (name) /ClrF 2 /SetFf 1 >>
<< /V ()/T (submit_name) /ClrF 2 /ClrFf 1 >>
<< /V ()/T (name_border) /ClrF 2 /ClrFf 1 >>
<< /V ()/T (name_border_red) /ClrF 2 /ClrFf 1 >>
<< /V (I seek the Holy Grail.)/T (quest) /ClrF 2 /SetFf 1 >>
<< /V ()/T (submit_quest) /ClrF 2 /ClrFf 1 >>
<< /V ()/T (quest_border) /ClrF 2 /ClrFf 1 >>
<< /V ()/T (quest_border_red) /ClrF 2 /ClrFf 1 >>
<< /V (Blue... no, yellow!)/T (color) /ClrF 2 /ClrFf 1 >>
<< /V ()/T (submit_color) /ClrF 2 /ClrFf 1 >>
<< /V ()/T (color_border) /ClrF 2 /ClrFf 1 >>
<< /V ()/T (color_border_red) /ClrF 2 /ClrFf 1 >>
<< /V ()/T (message_red) /ClrF 2 /ClrFf 1 >>
<< /V ()/T (message_green) /ClrF 2 /ClrFf 1 >>
]
>>
>>
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF
How are you generating your FDF? Here is an example FDF modified from a form I use pdftk with
field hierarchy like:
form1[0].Page1[0].Title[0]
form1[0].Page1[0].Item[0]
form1[0].Page1[0].Year[0]
form1[0].Page1[0].Desc[0]
%FDF-1.2 %���� 1 0 obj <<
/FDF <<
/Fields [
<< /T (form1[0]) /Kids [
<< /T (Page1[0]) /Kids [
<< /T (Title[0]) /V (Android Phone) /ClrF 2 /ClrFf 1 >>
<< /T (Item[0]) /V (Evo 3D) /ClrF 2 /ClrFf 1 >>
<< /T (Year[0]) /V (2011) /ClrF 2 /ClrFf 1 >>
<< /T (Desc[0]) /V (3D Smart Phone) /ClrF 2 /ClrFf 1 >>
] >>
] >>
]
>>
>> endobj trailer << /Root 1 0 R >> %%EOF
so you dont have the /Kids wrappers, and you arent using the field index numbers. Try modifying your FDF like my example to see if that works.
If you are a PHP user, you should check out pdftk-php. I use it on our server to inject mysql data into livecycle pdfs for a variety of uses and it takes care of the pdftk fdf injection part very nicely: http://www.andrewheiss.com/blog/2009/06/19/pdftk-php-officially-released/