Class 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.
Implements
Inherited Members
Namespace: pdftron.FDF
Assembly: PDFNet.dll
Syntax
public class FDFDoc : IDisposable
Remarks
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.
Constructors
FDFDoc()
Default constructor. Creates an empty FDF document.
Declaration
public FDFDoc()
FDFDoc(byte[], int)
Open an existing FDF document from an InputStream.
Declaration
public FDFDoc(byte[] buf, int buf_size)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buf |
|
int | buf_size |
|
Remarks
Make sure to call InitSecurityHandler() after FDFDoc(...) for encrypted documents.
FDFDoc(string)
Open an existing FDF document.
Declaration
public FDFDoc(string filepath)
Parameters
Type | Name | Description |
---|---|---|
string | filepath | pathname to the file. |
FDFDoc(Filter)
Open an existing FDF document from an InputStream.
Declaration
public FDFDoc(Filter stream)
Parameters
Type | Name | Description |
---|---|---|
Filter | stream |
|
Remarks
Make sure to call InitSecurityHandler() after FDFDoc(...) for encrypted documents.
FDFDoc(SDFDoc)
Create a FDF document from an existing SDF/Cos document.
Declaration
public FDFDoc(SDFDoc sdfdoc)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | sdfdoc | An SDF document. Created FDFDoc will take the ownership of the low-level document. |
Methods
Close()
Close FDFDoc and release associated resources
Declaration
public void Close()
CreateFromXFDF(string)
Create a new FDFDoc from XFDF input. Input can be either a XFDF file path, or the XFDF data itself.
Declaration
public static SDFDoc CreateFromXFDF(string xfdf)
Parameters
Type | Name | Description |
---|---|---|
string | xfdf | string containing either the file path to a XFDF file, or the XML buffer containing the XFDF. |
Returns
Type | Description |
---|---|
SDFDoc | created FDFDoc |
Dispose()
Releases all resources used by the FDFDoc
Declaration
public override sealed void Dispose()
Dispose(bool)
Declaration
[HandleProcessCorruptedStateExceptions]
protected virtual void Dispose(bool A_0)
Parameters
Type | Name | Description |
---|---|---|
bool | A_0 |
FieldCreate(string, int)
Create a new interactive form FDFField.
Declaration
public FDFField FieldCreate(string field_name, int type)
Parameters
Type | Name | Description |
---|---|---|
string | field_name | the field_name |
int | type | the field_type |
Returns
Type | Description |
---|---|
FDFField | the fDF field |
FieldCreate(string, int, string)
Create a FDFField with specified name, type and value
Declaration
public FDFField FieldCreate(string field_name, int type, string field_value)
Parameters
Type | Name | Description |
---|---|---|
string | field_name | the field_name |
int | type | the field_type |
string | field_value | the field_value |
Returns
Type | Description |
---|---|
FDFField | the FDF field |
FieldCreate(string, int, Obj)
Create a FDFField with specified name, type and string value
Declaration
public FDFField FieldCreate(string field_name, int type, Obj field_value)
Parameters
Type | Name | Description |
---|---|---|
string | field_name | the field_name |
int | type | the field_type |
Obj | field_value | the field_value |
Returns
Type | Description |
---|---|
FDFField | the FDF field |
~FDFDoc()
Allows an FDFDoc to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
Declaration
protected ~FDFDoc()
GetFDF()
Get the FDF dictionary.
Declaration
public Obj GetFDF()
Returns
Type | Description |
---|---|
Obj | the FDF dictionary located in "/Root" or NULL if dictionary is not present. |
GetField(string)
field_name a string representing the fully qualified name of the field (e.g. "employee.name.first").
Declaration
public FDFField GetField(string field_name)
Parameters
Type | Name | Description |
---|---|---|
string | field_name | the field_name |
Returns
Type | Description |
---|---|
FDFField | a FDFFieldIterator referring to the given interactive FDFField or if the field name was not found HasNext() will return false. |
GetFieldIterator()
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).
Declaration
public FDFFieldIterator GetFieldIterator()
Returns
Type | Description |
---|---|
FDFFieldIterator | an iterator to the first Filed in the document. |
Remarks
if the document has no AcroForms, HasNext()
GetFieldIterator(string)
Get the field iterator.
Declaration
public FDFFieldIterator GetFieldIterator(string field_name)
Parameters
Type | Name | Description |
---|---|---|
string | field_name | the field_name |
Returns
Type | Description |
---|---|
FDFFieldIterator | the field iterator |
GetID()
Get the ID entry from "/Root/FDF" dictionary.
Declaration
public Obj GetID()
Returns
Type | Description |
---|---|
Obj | An object representing the ID entry in "/Root/FDF" dictionary. |
GetPdfFileName()
Get the PDF document file that this FDF file was exported from or is intended to be imported into.
Declaration
public string GetPdfFileName()
Returns
Type | Description |
---|---|
string | a String with the PDF document file name. |
GetRoot()
Get the root.
Declaration
public Obj GetRoot()
Returns
Type | Description |
---|---|
Obj | A dictionary representing the Cos root of the document (/Root entry within the trailer dictionary) |
Remarks
This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.
GetSDFDoc()
Get the SDFDoc object in FDFDoc
Declaration
public SDFDoc GetSDFDoc()
Returns
Type | Description |
---|---|
SDFDoc | document's SDF/Cos document |
Remarks
This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.
GetTrailer()
Get the trailer.
Declaration
public Obj GetTrailer()
Returns
Type | Description |
---|---|
Obj | A dictionary representing the Cos root of the document (document's trailer) |
Remarks
This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.
IsModified()
determine whether the document is modified
Declaration
public bool IsModified()
Returns
Type | Description |
---|---|
bool | true if document was modified, false otherwise |
MergeAnnots(string)
Merge annotations into FDF document from an XML command.
Declaration
public void MergeAnnots(string command_file)
Parameters
Type | Name | Description |
---|---|---|
string | command_file | the path to XML command file, or the XML command itself |
MergeAnnots(string, string)
Merge annotations into FDF document from an XML command.
Declaration
public void MergeAnnots(string command_file, string permitted_user)
Parameters
Type | Name | Description |
---|---|---|
string | command_file | the path to XML command file, or the XML command itself |
string | permitted_user | the user name of the permitted user |
Save(string)
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.
Declaration
public void Save(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | The full path name to which the file is saved. |
Remarks
This method will count as a document usage for consumption-based licensing if the current document has not yet been counted.
SaveAsXFDF()
Save a FDF document into a XFDF string.
Declaration
public string SaveAsXFDF()
Returns
Type | Description |
---|---|
string | String containing the XFDF representation of the FDF document |
SaveAsXFDF(string)
Save a FDF document in XFDF format.
Declaration
public void SaveAsXFDF(string file_name)
Parameters
Type | Name | Description |
---|---|---|
string | file_name | the path |
SaveAsXFDF(string, XFDFExportOptions)
Save a FDF document in XFDF format.
Declaration
public void SaveAsXFDF(string file_name, XFDFExportOptions opts)
Parameters
Type | Name | Description |
---|---|---|
string | file_name | the path |
XFDFExportOptions | opts | Options controlling finer parameters of xfdf export |
SaveAsXFDF(XFDFExportOptions)
Save a FDF document into a XFDF string.
Declaration
public string SaveAsXFDF(XFDFExportOptions opts)
Parameters
Type | Name | Description |
---|---|---|
XFDFExportOptions | opts | Options controlling finer parameters of xfdf export |
Returns
Type | Description |
---|---|
string | String containing the XFDF representation of the FDF document |
SetID(Obj)
Set the ID entry in "/Root/FDF" dictionary.
Declaration
public void SetID(Obj id)
Parameters
Type | Name | Description |
---|---|---|
Obj | id | ID array object. |
SetPdfFileName(string)
Set the PDF document file that this FDF file was exported from or is intended to be imported into.
Declaration
public void SetPdfFileName(string filepath)
Parameters
Type | Name | Description |
---|---|---|
string | filepath | pathname to the file. |