Foxit PDF RDK

Public Member Functions | Static Public Attributes | List of all members
XFADoc Class Reference
Inheritance diagram for XFADoc:

## Public Member Functions
| XFADoc (document)
| Constructor. More...
| constructor (document)
| Constructor. More...
| constructor (document, xfa_doc_provider_handler)
| Constructor. More...
| constructor (other)
| Constructor, with another XFA document object. More...
| ExportData (output_file_path, export_type)
| Export data to a file. More...
| ExportData (output_file_path, export_type)
| Export data to a file. More...
| FlattenTo (output_file_path)
| Flatten current XFA document to a file. More...
| FlattenTo (output_file_path)
| Flatten current XFA document to a file. More...
| FlattenTo (stream)
| Flatten current XFA document to a file stream. More...
| GetPage (page_index)
| Get XFA page by index. More...
| GetPageCount ()
| Get XFA page count. More...
| GetType ()
| Get the XFA document type. More...
| GetWidgetByFullName (full_name)
| Get the XFA widget which matches the specified full name. More...
| ImportData (file_path)
| Import data from an XML or XDP file. More...
| ImportData (file_path)
| Import data from an XML or XDP file. More...
| ImportData (file_reader)
| Import data from a FileReaderCallback object. More...
| IsEmpty ()
| Check whether current object is empty or not. More...
| KillFocus ()
| Kill the focus of XFA widget. More...
| ProcessEvent (event_type)
| Process a kind of event for all the XFA widgets in current XFA document. More...
| ResetForm ()
| Reset form. More...
| SetDocProviderCallback (doc_provider_callback)
| Set XFA document provider callback. More...
| SetFocus (xfa_widget)
| Set the focus of XFA widget. More...
| SetPDFPath (pdf_file_path)
| Set the path of related PDF document. More...
| SetPDFPath (pdf_file_path)
| Set the path of related PDF document. More...
| StartLoad (pause)
| Start to load content for current XFA document. More...
Public Member Functions inherited from NativeObjectWrapper
| constructor (r)
| GetPointerAsNumber ()

## Static Public Attributes
static | e_Dynamic
| Enumeration for XFA document type. More...
static | e_EventTypePostPrint
| This kind of event is triggered just after the rendered form has been sent to the printer, spooler, or output destination.
static | e_EventTypePrePrint
| This kind of event is triggered just before the rendering for printing begins.
static | e_EventTypeUnknown
| Enumeration for XFA event type. More...
static | e_ExportDataTypeStaticXDP
| Type of exported data: Static XDP.
static | e_ExportDataTypeXDP
| Type of exported data: XDP.
static | e_ExportDataTypeXML
| Enumeration for the type of exported data. More...
static | e_Static
| XFA document type: Static.
static | e_XDP
| XFA document type: XDP, as Raw XML data.

## Detailed Description

Class XFADoc is constructed from a loaded PDF document object, in order to access XFA content more clearly. User must call Library.RegisterXFAAppProviderCallback before using XFA moudle. For a newly constructed XFA object, please remember to call function XFADoc.StartLoad before using other functions in class XFA.
To search among an XFA document, please construct a TextSearch object with XFADoc object.

See also
  TextSearch

Examples
  /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.

## Constructor & Destructor Documentation

## ◆ XFADoc()

XFADoc.XFADoc | ( | document |  | ) |

Constructor.

When constructing an XFADoc by this constructor successfully, user must set XFA document provider callback by function XFADoc.SetDocProviderCallback.

Parameters

  [in] | document | A valid PDF document. It should has been loaded successfully.

Note
  If module "XFA" is not defined in the license information which is used in function Library.Initialize, that means user has no right in using XFA related functions and this constructor will throw exception e_ErrNoXFAModuleRight.

## Member Function Documentation

## ◆ constructor() [1/3]

XFADoc.constructor | ( | document |  | ) |

Constructor.

When constructing an XFADoc by this constructor successfully, user must set XFA document provider callback by function XFADoc.SetDocProviderCallback.

Parameters

  [in] | document | A valid PDF document. It should has been loaded successfully.

Note
  If module "XFA" is not defined in the license information which is used in function common.Library.Initialize, that means user has no right in using XFA related functions and this constructor will throw exception foxit.e_ErrNoXFAModuleRight.

## ◆ constructor() [2/3]

XFADoc.constructor | ( | document | ,
|  | xfa_doc_provider_handler |
| ) |  |

Constructor.

Parameters

  [in] | document | A valid PDF document. It should has been loaded successfully.
  [in] | xfa_doc_provider_handler | An XFA document provider callback object which is implemented by user and based on callback class DocProviderCallback. It should not be null. User should ensure this callback object is kept valid until related PDF document is released.

Note
  If module "XFA" is not defined in the license information which is used in function Library.Initialize, that means user has no right in using XFA related functions and this constructor will throw exception e_ErrNoXFAModuleRight.

## ◆ constructor() [3/3]

XFADoc.constructor | ( | other |  | ) |

Constructor, with another XFA document object.

Parameters

  [in] | other | Another XFA document object

## ◆ ExportData() [1/2]

XFADoc.ExportData | ( | output_file_path | ,
|  | export_type |
| ) |  |

Export data to a file.

Parameters

  [in] | output_file_path | A file path, to which data will be exported to.
  [in] | export_type | Export type. Please refer to values starting from XFADoc.e_ExportDataTypeXML and this should be one of these values.

Returns
  true means success, while false means failure.

## ◆ ExportData() [2/2]

XFADoc.ExportData | ( | output_file_path | ,
|  | export_type |
| ) |  |

Export data to a file.

Parameters

  [in] | output_file_path | A file path, to which data will be exported to.
  [in] | export_type | Export type. Please refer to values starting from XFADoc.e_ExportDataTypeXML and this should be one of these values.

Returns
  true means success, while false means failure.

## ◆ FlattenTo() [1/3]

XFADoc.FlattenTo | ( | output_file_path |  | ) |

Flatten current XFA document to a file.

Parameters

  [in] | output_file_path | A file path, to which the flattening result will be saved.

Returns
  None.

## ◆ FlattenTo() [2/3]

XFADoc.FlattenTo | ( | output_file_path |  | ) |

Flatten current XFA document to a file.

Parameters

  [in] | output_file_path | A file path, to which the flattening result will be saved.

Returns
  None.

## ◆ FlattenTo() [3/3]

XFADoc.FlattenTo | ( | stream |  | ) |

Flatten current XFA document to a file stream.

Parameters

  [in] | stream | A StreamCallback object which is implemented by user to save the flattened result.

Returns
  None.

## ◆ GetPage()

XFADoc.GetPage | ( | page_index |  | ) |

Get XFA page by index.

Parameters

  [in] | page_index | The page index. Valid range: from 0 to (count-1). count is returned by function XFADoc.GetPageCount.

Returns
  The XFA page.

## ◆ GetPageCount()

XFADoc.GetPageCount | ( |  | ) |

Get XFA page count.

Returns
  Page count.

## ◆ GetType()

XFADoc.GetType | ( |  | ) |

Get the XFA document type.

Returns
  The type of XFA document. Please refer to values starting from XFADoc.e_Dynamic and this would be one of these values.

## ◆ GetWidgetByFullName()

XFADoc.GetWidgetByFullName | ( | full_name |  | ) |

Get the XFA widget which matches the specified full name.

Some XFA widgets may cover serveral XFA pages. In this case, this function can only be used to get the first matched XFA widget in XFA document. User can also use function XFAPage.GetWidgetByFullName to get the matched XFA widget in an XFA page.

Parameters

  [in] | full_name | An XFA widget's full name. It should not be an empty string. XFA widget's full name can be retrieved by function XFAWidget.GetName with type XFAWidget.e_WidgetNameTypeFullName in previous process.

Returns
  An XFA Widget object.

## ◆ ImportData() [1/3]

XFADoc.ImportData | ( | file_path |  | ) |

Import data from an XML or XDP file.

Parameters

  [in] | file_path | A path of a source file, whose data will be imported to current XFA document. It should be XML or XDP file and the file extension should be ".xml" or ".xdp".

Returns
  true means success, while false means failure.

## ◆ ImportData() [2/3]

XFADoc.ImportData | ( | file_path |  | ) |

Import data from an XML or XDP file.

Parameters

  [in] | file_path | A path of a source file, whose data will be imported to current XFA document. It should be XML or XDP file and the file extension should be ".xml" or ".xdp".

Returns
  true means success, while false means failure.

## ◆ ImportData() [3/3]

XFADoc.ImportData | ( | file_reader |  | ) |

Import data from a FileReaderCallback object.

Parameters

  [in] | file_reader | A FileReaderCallback object, whose data will be imported to current XFA document. It should be XML or XDP file.

Returns
  true means success, while false means failure.

## ◆ IsEmpty()

XFADoc.IsEmpty | ( |  | ) |

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.

## ◆ KillFocus()

XFADoc.KillFocus | ( |  | ) |

Kill the focus of XFA widget.

Returns
  None.

## ◆ ProcessEvent()

XFADoc.ProcessEvent | ( | event_type |  | ) |

Process a kind of event for all the XFA widgets in current XFA document.

Parameters

  [in] | event_type | An event type. Please refer to values starting from XFADoc.e_EventTypePostPrint and this should be one of these values except XFADoc.e_EventTypeUnknown.

Returns
  None.

## ◆ ResetForm()

XFADoc.ResetForm | ( |  | ) |

Reset form.

Returns
  None.

## ◆ SetDocProviderCallback()

XFADoc.SetDocProviderCallback | ( | doc_provider_callback |  | ) |

Set XFA document provider callback.

Parameters

  [in] | doc_provider_callback | An XFA document provider callback object which is implemented by user and based on callback class DocProviderCallback. It should not be null. User should ensure this callback object is kept valid until related PDF document is released.

Returns
  None.

## ◆ SetFocus()

XFADoc.SetFocus | ( | xfa_widget |  | ) |

Set the focus of XFA widget.

Parameters

  [in] | xfa_widget | An XFA widget which would be focused.

Returns
  None.

## ◆ SetPDFPath() [1/2]

XFADoc.SetPDFPath | ( | pdf_file_path |  | ) |

Set the path of related PDF document.

The PDF path will be used in function XFADoc.ExportData, to be a part of exported data.

Parameters

  [in] | pdf_file_path | The file path of related PDF document. It can be either an absolute path or a relative path. It should not be an empty string.

Returns
  None.

## ◆ SetPDFPath() [2/2]

XFADoc.SetPDFPath | ( | pdf_file_path |  | ) |

Set the path of related PDF document.

The PDF path will be used in function XFADoc.ExportData, to be a part of exported data.

Parameters

  [in] | pdf_file_path | The file path of related PDF document. It can be either an absolute path or a relative path. It should not be an empty string.

Returns
  None.

## ◆ StartLoad()

XFADoc.StartLoad | ( | pause |  | ) |

Start to load content for current XFA document.

It may take a long time to loading XFA content, so this function uses a progressive process to do this.
The related PDF document object has been loaded, but only PDF related contents have been loaded. So, in order to access XFA content, this function should be called to load XFA content.

Parameters

  [in] | pause | Pause object which decides if the importing process needs to be paused. This can be null which means not to pause during the parsing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function Progressive.GetRateOfProgress. If the rate is not 100 yet, call function Progressive.Continue to continue the progress until the progress is finished.

## Member Data Documentation

## ◆ e_Dynamic

XFADoc.e_Dynamic
| static

Enumeration for XFA document type.

Values of this enumeration should be used alone.

XFA document type: Dynamic.

## ◆ e_EventTypeUnknown

XFADoc.e_EventTypeUnknown
| static

Enumeration for XFA event type.

Values of this enumeration should be used alone.

Event type: Unknown.

## ◆ e_ExportDataTypeXML

XFADoc.e_ExportDataTypeXML
| static

Enumeration for the type of exported data.

Values of this enumeration should be used alone.

Type of exported data: XML.