PHP: Extract fdf fields as an array from a PDF

Confidence picture Confidence · Jan 11, 2012 · Viewed 7.2k times · Source

i want to extract the available fields as an array from a fillable pdf.

an array like: array('firstname','secondname','address');

i do not need the values for those fields, if they are filled.

what is easiest way to do that using PHP?

Answer

Murray McDonald picture Murray McDonald · Jan 11, 2012

under online documentation for "fdf_next_field_name" the following example is given that you can modify to store the field names into an array

<?php
$fdf = fdf_open($HTTP_FDF_DATA);
for ($field = fdf_next_field_name($fdf); $field != ""; $field = fdf_next_field_name($fdf, $field)) {
    echo "field: $field\n";
}
?>