Class: FDFDoc

PDFNet. FDFDoc

PDFNet.FDFDoc /** FDFDoc is a class representing Forms Data Format (FDF) documents. FDF is typically used when submitting form data to a server, receiving the response, and incorporating it into the interactive form. It can also be used to export form data to stand-alone files that can be stored, transmitted electronically, and imported back into the corresponding PDF interactive form. In addition, beginning in PDF 1.3, FDF can be used to define a container for annotations that are separate from the PDF document to which they apply.


new FDFDoc()

FDFFieldIterator is an iterator type used to traverse interactive form fields in a FDF document. A FDFFieldIterator points to FDF::FDFField nodes or to the 'null' FDFField node. A sample use case:

 for(FDFFieldIterator itr = fdf_doc.GetFieldIterator(); itr.HasNext(); itr.Next()) {
	cout << "Field name: " << itr.Current().GetName() << endl;
	cout << "Field partial name: " << itr.Current().GetPartialName() << endl;
 }

Methods


<static> create()

Default constructor that creates an empty new document.

Returns:

A promise that resolves to an object of type: "FDFDoc"

Type
PDFNet.FDFDoc

<static> createFromMemoryBuffer(buf)

Open a SDF/Cos document from a memory buffer.

Parameters:
Name Type Description
buf Array

a memory buffer containing the serialized document

Returns:

A promise that resolves to an object of type: "FDFDoc"

Type
PDFNet.FDFDoc

<static> createFromStream(stream)

Parameters:
Name Type Description
stream PDFNet.Filter
Returns:

A promise that resolves to an object of type: "FDFDoc"

Type
PDFNet.FDFDoc

<static> createFromXFDF(file_name)

Create a new FDFDoc from XFDF input. Input can be either a XFDF file path, or the XFDF data itself.

Parameters:
Name Type Description
file_name string

string containing either the file path to a XFDF file, or the XML buffer containing the XFDF.

Returns:

A promise that resolves to a new FDFDoc.

Type
PDFNet.FDFDoc

destroy()

Destructor


fieldCreate(field_name, type, field_value)

Parameters:
Name Type Description
field_name string
type number/enum
PDFNet.Field.Type = {
	e_button : 0
	e_check : 1
	e_radio : 2
	e_text : 3
	e_choice : 4
	e_signature : 5
	e_null : 6
}
field_value PDFNet.Obj
Returns:

A promise that resolves to an object of type: "fdffield"

Type
PDFNet.FDFField

fieldCreateFromString(field_name, type, field_value)

Parameters:
Name Type Description
field_name string
type number/enum
PDFNet.Field.Type = {
	e_button : 0
	e_check : 1
	e_radio : 2
	e_text : 3
	e_choice : 4
	e_signature : 5
	e_null : 6
}
field_value string
Returns:

A promise that resolves to an object of type: "fdffield"

Type
PDFNet.FDFField

getFDF()

Returns:

A promise that resolves to the FDF dictionary located in "/Root" or NULL if dictionary is not present.

Type
PDFNet.Obj

getField(field_name)

Parameters:
Name Type Description
field_name string

a string representing the fully qualified name of the field (e.g. "employee.name.first").

Returns:

A promise that resolves to a FDFField associated with the given field_name or invalid field (null) if the field is not found.

Type
PDFNet.fdffield

getFieldIterator(field_name)

An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A FDF document may contain any number of fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document.

The following methods are used to access and manipulate Interactive form fields (sometimes referred to as AcroForms).

Parameters:
Name Type Description
field_name string
Returns:

A promise that resolves to an iterator to the first Filed in the document.

Type
PDFNet.Iterator

getFieldIterator(field_name)

Parameters:
Name Type Description
field_name string
Returns:

A promise that resolves to an object of type: "Iterator"

Type
PDFNet.Iterator

getFieldIteratorBegin()

An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A FDF document may contain any number of fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document.

The following methods are used to access and manipulate Interactive form fields (sometimes referred to as AcroForms).

Returns:

A promise that resolves to an iterator to the first Filed in the document.

Type
PDFNet.Iterator

getID()

Get the ID entry from "/Root/FDF" dictionary.

Returns:

A promise that resolves to An object representing the ID entry in "/Root/FDF" dictionary.

Type
PDFNet.Obj

getPDFFileName()

Get the PDF document file that this FDF file was exported from or is intended to be imported into.

Returns:

A promise that resolves to a String with the PDF document file name.

Type
string

getRoot()

Returns:

A promise that resolves to A dictionary representing the Cos root of the document (/Root entry within the trailer dictionary)

Type
PDFNet.Obj

getSDFDoc()

Returns:

A promise that resolves to document's SDF/Cos document

Type
PDFNet.SDFDoc

getTrailer()

Returns:

A promise that resolves to A dictionary representing the Cos root of the document (document's trailer)

Type
PDFNet.Obj

isModified()

Returns:

A promise that resolves to true if document was modified, false otherwise

Type
boolean

mergeAnnots(command_file, permitted_user)

Merge the annotations from XFDF file into FDF file

Parameters:
Name Type Description
command_file string

string containing the xml command file path or xml string of the command

permitted_user string

optional user name of the permitted user


saveAsXFDFAsString()

Export FDF file as a XFDF string

Returns:

A promise that resolves to a UString containing the XFDF representation of the FDF file

Type
string

saveMemoryBuffer()

Saves the document to a memory buffer.


setID(id)

Set the ID entry in "/Root/FDF" dictionary.

Parameters:
Name Type Description
id PDFNet.Obj

ID array object.


setPDFFileName(filepath)

Set the PDF document file that this FDF file was exported from or is intended to be imported into.

Parameters:
Name Type Description
filepath string

pathname to the file.