phparraysformspdffdf

PHP: Extract fdf fields as an array from a PDF


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?


Solution

  • 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";
    }
    ?>