Provided by: libpdf-fdf-simple-perl_0.21-3_all bug


       PDF::FDF::Simple - Read and write (Acrobat) FDF files.


         my $fdf = new PDF::FDF::Simple ({ filename => '/tmp/test.fdf' });
         $fdf->skip_undefined_fields (1);
         $fdf->content ({
                         'name'                 => 'Fred Madison',
                         'organisation'         => 'Luna Lounge Ltd.',
                         ''    => 'Hello world.',
                         '' => 'French',
                         'my.checkbox.value'    => 'On',   # 'On' / 'Off'
         $fdf->save or print $fdf->errmsg;
         $fdf->save ('otherfile.fdf');
         my $fdfcontent = $fdf->load;
         $fdfcontent = $fdf->load ($fdfstring);
         print $fdf->{'organisation'};
         print $fdf->{''};
         print $fdf->as_string;
         print "Corresponding PDF (attribute /F): ".$fdf->attribute_file."\n";
         print "IDs (attribute /ID): ";
         print $_ foreach @{$fdf->attribute_id}; print "\n";


       Helps creating and extracting the content of FDF files. It is meant to be a simple
       replacement for the Adobe FdfToolkit. Therefore some of it's behavior, especially handling
       of diverse whitespace/newline artefacts is orientated on FdfToolkit's handling.

       After the extraction process the content is available within a hash reference.

       For creating FDF files it currently only supports setting text values. Anyway, this should
       be enough to create FDF files for text fields, text areas, checkboxes and radio buttons.

       PDF::FDF::Simple uses Parse::RecDescent and understands both, the "Kids" notation and the
       "dotted" notation for field names. Saving will always use the "dotted"- notation.

   Text fields / Text areas
       Text fields and text areas are simply filled with the given text.

   Radio button groups
       In a radio button group the entry that matches exactly the field value is selected. The
       entries and their values are defined in the PDF where the FDF is loaded into.

       In the PDF document into which the FDF is loaded a checkbox field is set to
       checked/unchecked with field values 'On' or 'Off', respectively.

API Methods

       Constructor. Takes a hash reference for arguments.

       Option, default is 0. If set to a true value (e.g., 1), then fields whose value is
       undefined are not contained in generated fdf. By default undefined field values are
       converted to empty string ('').

       Get/set target filename (string).

       Get/set content of fields (hashref).

       Get/set the corresponding PDF filename of the form.  This method corresponds to the /F
       attribute in FDF content.

       Get/set the corresponding PDF filename of the form.  This method corresponds to the /UF
       attribute in FDF content. It is not perfectly clear whether the /UF means the same as /F.
       It was used when Acrobat 8 appeared, but it seems to be not documented. I named it just
       "ufile" due to lack of better knowledge.

       Get/set the list (array reference) of form IDs.  This method corresponds to the /ID
       attribute in FDF content.

       Load an existing FDF file named via "filename" and stores the information in a hashref
       (see also "content").

       An optional parameter can be given that contains FDF content. In that case it is not read
       from file "filename".

   save (optional_filename)
       Save the FDF content into a file, using either the directly given "optional_filename"
       parameter or (if "optional_filename" is not given) the filename that was set via

       Returns the FDF content as scalar string, so you can work with it without the need to save
       into file.

       Get/set error message. Will be set internally when an error occured. Just read it, setting
       it is useless.

Internal Methods

       Those methods are used internally and can be overwritten in derived classes. You shouldn't
       use them directly.

       Overwritable method for setting default values for initialization before overtaking
       constructor params.

       Overwritable method for setting default values for initialization after overtaking
       constructor params and building Parse::RecDescent grammar.

       Takes over the values from the given constructor hash.

       Returns a string which will be written before all field data.

       Returns a string which will be written after all field data.

       Does all quoting for field value strings.

       Returns a format string for use in sprintf that creates key/value pairs.

       Puts the Parse::RecDescent output from a nested hash into a simple hash and returns its


       ·   Parse::RecDescent (VERSION 1.94)

       ·   Class::Accessor


       For whose who are interested, the grammar doesn't implement a fully PDF or FDF
       specification (FDF is just a subset of PDF). The approach is rather pragmatic. It only
       searches for /Fields and tries to ignore the surrounding rest. This "works for me" (TM)
       but it doesn't guarantee that all possible FDFs can be parsed. If you have a strange FDF
       that cannot be parsed please send it to me with the expected content description or extend
       the parser by yourself and send me a patch.


       ·   Steffen Schwigon <>,

       ·   Tim Schreier


       The public repository is hosted on github:

         git clone git://


       Copyright (c) 2004 .. 2008 Steffen Schwigon. All rights reserved. This program is free
       software; you can redistribute it and/or modify it under the same terms as Perl itself.


       I am interested in comments/enhancements/bugreports. Drop me <> a mail
       if you use this module.