mikehaertl/php-pdftk

FieldStateOption array order

iagorc opened this issue · 3 comments

Hi:

I have a problem when i try to access to the data values of FieldType Button when i use the function getDataFields with arrays.

I dont understand how it works. Sometimes FieldStateOption array gets one order of the values and sometimes others.

Could you explain to me what criteria is used in the order in which the information is represented in these arrays?

Thanks, best regards.

The order should be the same as you see it in pdftk file.pdf dump_data_fields_utf8. If this is not the case could you paste:

  • the output of that command
  • what you get in PHP
  • what you would expect

I have a pdf with a ButtonType that contains 3 values: option1, option2 and option 3, in this order. When i dump the result i get this:
image
I dont understand why this array is not ordered at the same way of my Button in pdf ([option1,option2,option3])
This is the first element of my ButtonType:
image

Thanks

We have no control in which order pdftk returns the fields. It's probably the order that they are stored in the internal PDF format. In any case this is rather an issue for pdftk, not for our library here.