My Project
foxit::fdf::FDFDoc Class Reference
Inheritance diagram for foxit::fdf::FDFDoc:
foxit::Base

Public Types

enum  Type { e_FDF = 0, e_XFDF = 1 }
 Enumeration for FDF document type. More...
 

Public Member Functions

 FDFDoc (common::file::ReaderCallback *file_read)
 Constructor, with a file read callback object. More...
 
 FDFDoc (Type type)
 Constructor. More...
 
 FDFDoc (const char *path)
 Constructor, from an existing FDF or XFDF file path. More...
 
 FDFDoc (const wchar_t *path)
 Constructor, from an existing FDF or XFDF file path. More...
 
 FDFDoc (const void *buffer, size_t length)
 Constructor, from a memory buffer. More...
 
 FDFDoc (std::ifstream *input_file_stream)
 Constructor, with std::ifstream. More...
 
 FDFDoc (const FDFDoc &other)
 Constructor, with another FDF document object. More...
 
 ~FDFDoc ()
 Destructor.
 
pdf::objects::PDFDictionaryGetCatalog () const
 Get the catalog dictionary. More...
 
pdf::objects::PDFDictionaryGetFDFDict () const
 Get the dictionary of "FDF" entry from catalog dictionary. More...
 
WString GetPDFPath ()
 Get the path of related PDF document. More...
 
Type GetType () const
 Get the type of current document object. More...
 
bool IsEmpty () const
 Check whether current object is empty or not. More...
 
bool operator != (const FDFDoc &other) const
 Not equal operator. More...
 
FDFDocoperator= (const FDFDoc &other)
 Assign operator. More...
 
bool operator== (const FDFDoc &other) const
 Equal operator. More...
 
bool SaveAs (const char *file_path)
 Save current document as another FDF or XFDF file. More...
 
bool SaveAs (const wchar_t *file_path)
 Save current document as another FDF or XFDF file. More...
 
bool SaveAs (foxit::common::file::WriterCallback *file)
 Save current document as another FDF or XFDF file. More...
 
bool SetPDFPath (const wchar_t *pdf_path)
 Set the path of related PDF document. More...
 
- Public Member Functions inherited from foxit::Base
FS_HANDLE Handle () const
 Get the handle of current object. More...
 

Detailed Description

FDF (Forms Data Format) is a kind of file format, used for interactive form data. FDF can be 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. Besides these, FDF can be used to define a container for annotations that are separated from the PDF document to which they apply.
XFDF(XML Forms Data Format) is a version of FDF based on XML. It has similar features with FDF.
In a word, FDF and XFDF contain the subset of a PDF document to describe interactive forms and annotations.
Class FDFDoc can be used to represent either FDF or XFDF. A FDF document object can be constructed with an existing file from file path, memory buffer, a custom implemented common::file::ReaderCallback object and an input file stream. A FDF document object can also be constructed as a new FDF or XFDF document. This class also offers functions to get or set some information from FDF or XFDF file, and save current FDF/XFDF as another file.
To import or export form fields or annotations, please refer to functions pdf::PDFDoc::ImportFromFDF, pdf::PDFDoc::ExportToFDF and pdf::PDFDoc::ExportAnnotToFDF.

See also
pdf::PDFDoc

Member Enumeration Documentation

◆ Type

Enumeration for FDF document type.

Values of this enumeration should be used alone.

Enumerator
e_FDF 

FDF document type: FDF.

e_XFDF 

FDF document type: XFDF.

Constructor & Destructor Documentation

◆ FDFDoc() [1/7]

foxit::fdf::FDFDoc::FDFDoc ( common::file::ReaderCallback file_read)
explicit

Constructor, with a file read callback object.

Parameters
[in]file_readPointer to a common::file::ReaderCallback object which is implemented by user to load a FDF or XFDF document. It should not be NULL.

◆ FDFDoc() [2/7]

foxit::fdf::FDFDoc::FDFDoc ( Type  type)
explicit

Constructor.

This constructor is to construct a new FDF document object (without any data).

Parameters
[in]typeFDF document type. It should be one of following values:
fdf::FDFDoc::e_FDF, FDFDoc::e_XFDF

◆ FDFDoc() [3/7]

foxit::fdf::FDFDoc::FDFDoc ( const char *  path)
explicit

Constructor, from an existing FDF or XFDF file path.

Parameters
[in]pathA full path of an existing FDF/XFDF file. It should not be an empty string.

◆ FDFDoc() [4/7]

foxit::fdf::FDFDoc::FDFDoc ( const wchar_t *  path)
explicit

Constructor, from an existing FDF or XFDF file path.

Parameters
[in]pathA full path of an existing FDF/XFDF file. It should not be an empty string.

◆ FDFDoc() [5/7]

foxit::fdf::FDFDoc::FDFDoc ( const void *  buffer,
size_t  length 
)

Constructor, from a memory buffer.

Parameters
[in]bufferA memory buffer. The FDF or XFDF file data should be fully loaded in this memory buffer. It should not be NULL.
[in]lengthThe size of memory buffer. It should be above 0.

◆ FDFDoc() [6/7]

foxit::fdf::FDFDoc::FDFDoc ( std::ifstream *  input_file_stream)
explicit

Constructor, with std::ifstream.

Parameters
[in]input_file_streamA std::ifstream object. It should not be NULL. Please ensure this stream has been associated with an image file by calling std::ifstream::open() successfully with parameter mode containing "ios_base::binary".

◆ FDFDoc() [7/7]

foxit::fdf::FDFDoc::FDFDoc ( const FDFDoc other)

Constructor, with another FDF document object.

Parameters
[in]otherAnother FDF document object.

Member Function Documentation

◆ GetCatalog()

pdf::objects::PDFDictionary* foxit::fdf::FDFDoc::GetCatalog ( ) const

Get the catalog dictionary.

Note
If current object represents an XFDF document, this function will return NULL.
Returns
The catalog dictionary.

◆ GetFDFDict()

pdf::objects::PDFDictionary* foxit::fdf::FDFDoc::GetFDFDict ( ) const

Get the dictionary of "FDF" entry from catalog dictionary.

Note
If current object represents an XFDF document, this function will return NULL.
Returns
The dictionary of "FDF" entry from catalog dictionary.

◆ GetPDFPath()

WString foxit::fdf::FDFDoc::GetPDFPath ( )

Get the path of related PDF document.

The path can be either an absolute one, or a relative one.

Returns
File path of related PDF document. Empty string means no such information is found.

◆ GetType()

Type foxit::fdf::FDFDoc::GetType ( ) const

Get the type of current document object.

Returns
FDF document type. It would be one of following values:
fdf::FDFDoc::e_FDF, FDFDoc::e_XFDF.

◆ IsEmpty()

bool foxit::fdf::FDFDoc::IsEmpty ( ) const

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
true means current object is empty, while false means not.

◆ operator !=()

bool foxit::fdf::FDFDoc::operator != ( const FDFDoc other) const

Not equal operator.

Parameters
[in]otherAnother FDF document object. This function will check if current object is not equal to this one.
Returns
true means not equal, while false means equal.

◆ operator=()

FDFDoc& foxit::fdf::FDFDoc::operator= ( const FDFDoc other)

Assign operator.

Parameters
[in]otherAnother FDF document object, whose value would be assigned to current object.
Returns
Reference to current object itself.

◆ operator==()

bool foxit::fdf::FDFDoc::operator== ( const FDFDoc other) const

Equal operator.

Parameters
[in]otherAnother FDF document object. This function will check if current object is equal to this one.
Returns
true means equal, while false means not equal.

◆ SaveAs() [1/3]

bool foxit::fdf::FDFDoc::SaveAs ( const char *  file_path)

Save current document as another FDF or XFDF file.

Parameters
[in]file_pathA full path of the new saved FDF or XFDF file. It should not be an empty string.
Returns
true means success, while false means failure.
Note
This function does not support to save current FDF object just back to the FDF or XFDF file which is used to construct current FDF object. In order to do so, user is recommended to do as following steps:
Assume that current FDF object is constructed from a FDF file named "org.fdf".
  1. Use current function to save current FDF object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current FDF object has destructed.
  3. Remove "org.fdf" and rename "temp.tmp" to "org.fdf".

◆ SaveAs() [2/3]

bool foxit::fdf::FDFDoc::SaveAs ( const wchar_t *  file_path)

Save current document as another FDF or XFDF file.

Parameters
[in]file_pathA full path of the new saved FDF or XFDF file. It should not be an empty string.
Returns
true means success, while false means failure.
Note
This function does not support to save current FDF object just back to the FDF or XFDF file which is used to construct current FDF object. In order to do so, user is recommended to do as following steps:
Assume that current FDF object is constructed from a FDF file named "org.fdf".
  1. Use current function to save current FDF object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current FDF object has destructed.
  3. Remove "org.fdf" and rename "temp.tmp" to "org.fdf".

◆ SaveAs() [3/3]

bool foxit::fdf::FDFDoc::SaveAs ( foxit::common::file::WriterCallback file)

Save current document as another FDF or XFDF file.

Parameters
[in]fileA common::file::WriterCallback object which is implemented by user to save FDF or XFDF file.
Returns
true means success, while false means failure.
Note
This function does not support to save current FDF object just back to the FDF or XFDF file which is used to construct current FDF object. In order to do so, user is recommended to do as following steps:
Assume that current FDF object is constructed from a FDF file named "org.fdf".
  1. Use current function to save current FDF object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current FDF object has destructed.
  3. Remove "org.fdf" and rename "temp.tmp" to "org.fdf".

◆ SetPDFPath()

bool foxit::fdf::FDFDoc::SetPDFPath ( const wchar_t *  pdf_path)

Set the path of related PDF document.

Parameters
[in]pdf_pathThe path of related PDF document. It can be either an absolute path or a relative path. It should not be an empty string.
Returns
true means success, while false means failure.

Foxit Software Corporation Logo
@2019 Foxit Software Incorporated. All rights reserved.