Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Forms Data Format Functions : fdf_enum_values

fdf_enum_values

Call a user defined function for each document value (PHP 4 >= 4.3.0, PHP 5)
bool fdf_enum_values ( resource fdf_document, callback function [, mixed userdata] )


Code Examples / Notes » fdf_enum_values

ceo

If you need something like this in a pre 4.3 version, here is a rough hack I was working on before I realized I didn't need this after all.
       preg_match('/Fields\[(.*)\]/', $raw_pdf, $field_data);
       echo "Fields: ", htmlentities($field_data[1]), "<HR>\n";
       $field_data = $field_data[1];
       $key_value = explode(">><<", $field_data);
       $key_value[0] = substr($key_value[0], 2);
       $key_value[count($key_value) - 1] = substr($key_value[count($key_value) - 1], 0, -2);
       while (list(, $kv) = each($key_value)){
               list($key, $value) = explode("/V", $kv);
               $key = substr($key, 2);
               if ($key[0] == '('){
                       $key = substr($key, 1, -1);
               }
               if ($value[0] == '/'){
                       $value = substr($value, 1);
               }
               if ($value[0] == '('){
                       $value = substr($value, 1, -1);
               }
               echo "Key: $key Value: $value
\n";
       }
The $raw_pdf can either be the $HTTP_RAW_POST_DATA before you write a submitted PDF, or it can just be the raw PDF data you would read from a PDF using, say:
$raw_pdf = implode("", file("/path/to/your/fdf/whatever.pdf"));
You'll probably need to tweak this to do something more interesting than just printing the stuff.
Hmmmm.  Think they'll throw me in jail for this post?  Oh well.


Change Language


Follow Navioo On Twitter
fdf_add_doc_javascript
fdf_add_template
fdf_close
fdf_create
fdf_enum_values
fdf_errno
fdf_error
fdf_get_ap
fdf_get_attachment
fdf_get_encoding
fdf_get_file
fdf_get_flags
fdf_get_opt
fdf_get_status
fdf_get_value
fdf_get_version
fdf_header
fdf_next_field_name
fdf_open_string
fdf_open
fdf_remove_item
fdf_save_string
fdf_save
fdf_set_ap
fdf_set_encoding
fdf_set_file
fdf_set_flags
fdf_set_javascript_action
fdf_set_on_import_javascript
fdf_set_opt
fdf_set_status
fdf_set_submit_form_action
fdf_set_target_frame
fdf_set_value
fdf_set_version
eXTReMe Tracker