Extracting as FDF/XML

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  SPS File: Presentation > Fillable PDF Forms > Form Data >

Extracting as FDF/XML

After a user has entered fillable PDF form data, they can extract the form data to an FDF file or XML file frrom an input PDF file. This is done by invoking Altova StyleVision Server's pdfdata command, as follows:

 

stylevisionserver pdfdata [options] InputPDF

 

 

The options specify the output file formats and locations:

--outfdf

Specifies the absolute path to the generated FDF file. Form: --outfdf=FILE

--outxml

Specifies the absolute path to the generated XML file. Form: --outxml=FILE

 

 

Examples of the pdfdata command:

 

stylevisionserver pdfdata --outfdf=C:\test\forms\FDFData.fdf C:\test\forms\TestForm.pdf

stylevisionserver pdfdata --outxml=C:\test\forms\XMLData.xml C:\test\forms\TestForm.pdf

 

FDF file

The generated FDF file contains the data of the PDF file's form data fields. The FDF file can be opened in a Adobe Reader, Adobe Acrobat, and any text editor.

 

If you open the FDF file in Adobe Reader or Adobe Acrobat, then the application will attempt to open the PDF file that is associated with the FDF file. If it cannot locate the PDF file, then it will prompt you to browse for the PDF file. If the PDF file is located, then the PDF file will be opened and you will be asked, in the yellow ribbon at the top of the document, whether you wish to trust the FDF document. If you trust the FDF document, then the data in the FDF file will be loaded into the PDF file.
If you open the FDF file in a text editor, you can edit the form data in it and save the FDF file. This FDF file can then be used with a corresponding PDF file.

 

XML file

The XML file is generated with a root element named pdf-form-data (see listing below) The root element has child page elements, each of which corresponds to a page in the PDF document. Each page element contains child elements that correspond to the form data fields on that page. (We will call the elements at this level form-field elements.) For example: If there are five fields on a page, then there will be five corresponding form-field XML elements in the generated XML file. Note that radio buttons assigned to one XML node in the design will be generated as one form-field XML element in the XML file.

 

 

<pdf-form-data>

  <page index="1">

    <firstname>John</firstname>

    <idelem4x8>Doe</idelem4x8>

    <gender_id>male</gender_id>

    <idelem4x17>mail01@altova.com</idelem4x17>

    <!--Incorrect XML name "4newsletter" was replaced by "altova:element-0" element name.-->

    <altova:element-0>Off</altova:element-0>

  </page>

  <page index="2">

    <firstname>Jane</firstname>

    <idelem4x26>Doe</idelem4x26>

    <gender_id>female</gender_id>

    <idelem4x35>mail02@altova.com</idelem4x35>

    <!--Incorrect XML name "4newsletter" was replaced by "altova:element-0" element name.-->

    <altova:element-0>Off</altova:element-0>

  </page>

</pdf-form-data>

 

 

Names of form-field elements

Note the following points:

 

If, in the design, a form control has a valid XML element-name value as the string value of its Fillable PDF Form property Output element name, then this name is used as the name of the corresponding form-field element. If the value of the Output element name property is an invalid XML element name, then an XML element name is generated; the replacement is noted as a comment (see the last form-field element in the listing above).
If, in the design, a form control has no Output element name property value (see previous point), but has a valid XML element-name value for its id property (under the Common group of properties), then the value of the id property is used as the name of the corresponding form-field element. If the value of the id property is an invalid XML element name, then an XML element name is generated; the replacement is noted as a comment.
If no value is specified for either Output element name property or the id property, then an XML element name is auto-generated. See, for example, the second form-field element in the listing above.

 


© 2019 Altova GmbH