0

I am using FDF to fill the pdf with php . I have some checkboxes in the pdf .

I searched a lot on interment . I refered these links refer1 link2.

currently i used this

<</T(form1[0].#subform[6].Checkbox1a[0])/V(1)>>
<</T(form1[0].#subform[6].Checkbox1b[0])/V(checked)>>
<</T(form1[0].#subform[6].Checkbox1c[0])/V(yes)>>
<</T(form1[0].#subform[6].Checkbox1d[0])/V(on)>>

I have tried 1, checked, yes , on etc but failed to ckeck the checkbox . this is one of the pdf i am using to fill pdf link

Community
  • 1
  • 1
Manoj Dhiman
  • 5,096
  • 6
  • 29
  • 68
  • What is the return value of the checkbox? Are you sure that it is a PDF form? the field naming looks a lot like XFA to me. Do text fields fill properly? – Max Wyss May 19 '15 at 05:54
  • yes text fields are ok . Only problem is checkbox and radio box – Manoj Dhiman May 19 '15 at 06:06
  • In this case, you have to find the return value of the box, and that is to become the /V value in your FDF. So, if it is "yes", it would be /V(yes), if it is "hullaboo", it would be /V(hullaboo). A special case is "unchecked", which is always "Off". – Max Wyss May 19 '15 at 06:39

1 Answers1

0

In the PDF specification the V entry of a check box is described as following:

The V entry in the field dictionary [...] holds a name object representing the check box’s appearance state, which shall be used to select the appropriate appearance from the appearance dictionary.

It is also defined that the name for the in state should be Yes but that's not always the case. In your document the on state is defined as Y.

So your FDF data should look like:

<</T(form1[0].#subform[6].Checkbox1a[0])/V/Y>>

For completion: If the export value is non-Latin text (by using an Opt array) e.g. Acrobat doesn't use a name object but a string, too:

<</T(form1[0].#subform[6].Checkbox1a[0])/V(Y)>>

This behaviour seems to be un-documentated.

Jan Slabon
  • 4,736
  • 2
  • 14
  • 29
  • it works . A question . will it be same for all the pdfs?? I mean i have to use Y for every checkbox to checked or there may be some different?? – Manoj Dhiman May 19 '15 at 09:32
  • No, it depends on the export value of the checkbox, which you or your programm needs to know. Only the off state is defined as "shall be [...] the name **Off**". – Jan Slabon May 19 '15 at 09:55