new 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.
Note: While the constructor does not, a few methods in FDFDoc will
cause it to count as a document for the consumption-based licensing
if was not created through PDFDoc::FDFExtract().
Please consult individual API documentation for exact details.
Extends
Classes
Methods
-
<static> create()
-
Default constructor that creates an empty new document.
Returns:
A promise that resolves to an object of type: "PDFNet.FDFDoc"- Type
- Promise.<PDFNet.FDFDoc>
-
<static> createFromFilePath(filepath)
-
Open an existing FDF document
Parameters:
Name Type Description filepath
string pathname to the file. Returns:
A promise that resolves to an object of type: "PDFNet.FDFDoc"- Type
- Promise.<PDFNet.FDFDoc>
-
<static> createFromMemoryBuffer(buf)
-
Open a SDF/Cos document from a memory buffer. Note: the document should be fully loaded in the memory buffer. Note: the buffer ownership is not transfered to the Document so the user should clean-up if necessary.
Parameters:
Name Type Description buf
ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray a memory buffer containing the serialized document Returns:
A promise that resolves to an object of type: "PDFNet.FDFDoc"- Type
- Promise.<PDFNet.FDFDoc>
-
<static> createFromStream(stream)
-
Open an existing FDF document
Parameters:
Name Type Description stream
PDFNet.Filter input stream containing a serialized document. The input stream may be a random-access file, memory buffer, slow HTTP connection etc. Note: if the input stream doesn't support Seek() operation the document will load whole data stream in memory before parsing. In case of linearized FDF, the document may be parsed on-the-fly while it is being loaded in memory. Note that since StdFile implements Seek() interface, the document does not have to be fully in memory before it is used. Note: Make sure to call InitSecurityHandler() after FDFDoc(...) for encrypted documents. Returns:
A promise that resolves to an object of type: "PDFNet.FDFDoc"- Type
- Promise.<PDFNet.FDFDoc>
-
<static> createFromUFilePath(filepath)
-
Parameters:
Name Type Description filepath
string Returns:
A promise that resolves to an object of type: "PDFNet.FDFDoc"- Type
- Promise.<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
- Promise.<PDFNet.FDFDoc>
-
<static> createXFDFExportOptions()
-
Method to create a XFDFExportOptions object
Returns:
A promise that resolves to a PDFNet.FDFDoc.XFDFExportOptions.- Type
- Promise.<PDFNet.FDFDoc.XFDFExportOptions>
-
destroy()
-
Destructor
- Inherited From:
Returns:
- Type
- Promise.<void>
-
fieldCreate(field_name, type [, field_value])
-
Create a new interactive form FDFField.
Parameters:
Name Type Argument Description field_name
string type
number 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 <optional>
Returns:
A promise that resolves to- Type
- Promise.<PDFNet.FDFField>
-
fieldCreateFromString(field_name, type, field_value)
-
Parameters:
Name Type Description field_name
string type
number 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: "PDFNet.FDFField"- Type
- Promise.<PDFNet.FDFField>
-
getFDF()
-
Returns:
A promise that resolves to the FDF dictionary located in "/Root" or NULL if dictionary is not present.- Type
- Promise.<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
- Promise.<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 String representing the name of the FDFField to get. Returns:
A promise that resolves to an iterator to the FDFField in the document. Note: if the document has no AcroForms, HasNext() will return false.- Type
- Promise.<PDFNet.Iterator.<PDFNet.FDFField>>
-
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 FDFField in the document. Note: if the document has no AcroForms, HasNext() will return false.- Type
- Promise.<PDFNet.Iterator.<PDFNet.FDFField>>
-
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
- Promise.<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
- Promise.<string>
-
getRoot()
-
Returns:
A promise that resolves to A dictionary representing the Cos root of the document (/Root entry within the trailer dictionary) Note: This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.- Type
- Promise.<PDFNet.Obj>
-
getSDFDoc()
-
Returns:
A promise that resolves to document's SDF/Cos document Note: This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.- Type
- Promise.<PDFNet.SDFDoc>
-
getTrailer()
-
Returns:
A promise that resolves to A dictionary representing the Cos root of the document (document's trailer) Note: This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.- Type
- Promise.<PDFNet.Obj>
-
isModified()
-
Returns:
A promise that resolves to true if document was modified, false otherwise- Type
- Promise.<boolean>
-
mergeAnnots(command_file [, permitted_user])
-
Merge the annotations from XFDF file into FDF file
Parameters:
Name Type Argument Description command_file
string string containing the xml command file path or xml string of the command permitted_user
string <optional>
optional user name of the permitted user Returns:
- Type
- Promise.<void>
-
save(path)
-
Saves the document to a file. If a full save is requested to the original path, the file is saved to a file system-determined temporary file, the old file is deleted, and the temporary file is renamed to path. A full save with remove unused or linearization option may re-arrange object in the cross reference table. Therefore all pointers and references to document objects and resources should be re acquired in order to continue document editing. In order to use incremental save the specified path must match original path and e_incremental flag bit should be set.
Parameters:
Name Type Description path
string The full path name to which the file is saved. Note: This method will count as a document usage for consumption-based licensing if the current document has not yet been counted. Returns:
- Type
- Promise.<void>
-
saveAsXFDF(filepath)
-
Export FDF file as an XFDF file
Parameters:
Name Type Description filepath
string the filepath of the exported XFDF file Returns:
- Type
- Promise.<void>
-
saveAsXFDFAsString()
-
Returns:
A promise that resolves to an object of type: "string"- Type
- Promise.<string>
-
saveAsXFDFAsStringWithOptions( [opts])
-
Export FDF file as a XFDF string
Parameters:
Name Type Argument Description opts
PDFNet.FDFDoc.XFDFExportOptions <optional>
Options controlling finer parameters of xfdf export Returns:
A promise that resolves to a UString containing the XFDF representation of the FDF file- Type
- Promise.<string>
-
saveAsXFDFWithOptions(filepath [, opts])
-
Export FDF file as an XFDF file
Parameters:
Name Type Argument Description filepath
string the filepath of the exported XFDF file opts
PDFNet.FDFDoc.XFDFExportOptions <optional>
Options controlling finer parameters of xfdf export Returns:
- Type
- Promise.<void>
-
saveMemoryBuffer()
-
Saves the document to a memory buffer. Note: This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.
Returns:
A promise that resolves to an object of type: "Uint8Array"- Type
- Promise.<Uint8Array>
-
setID(id)
-
Set the ID entry in "/Root/FDF" dictionary.
Parameters:
Name Type Description id
PDFNet.Obj ID array object. Returns:
- Type
- Promise.<void>
-
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. Returns:
- Type
- Promise.<void>
-
takeOwnership()
-
Take the ownership of this object, so that PDFNet.runWithCleanup won't destroy this object.
- Inherited From:
Returns:
- Type
- void