Foxit PDF SDK

Public Member Functions | Static Public Attributes | List of all members
com.foxit.sdk.addon.xfa.XFADoc Class Reference
Inheritance diagram for com.foxit.sdk.addon.xfa.XFADoc:

## Public Member Functions
| XFADoc (PDFDoc document) throws com.foxit.sdk.PDFException
| Constructor. More...
| XFADoc (PDFDoc document, DocProviderCallback xfa_doc_provider_handler) throws com.foxit.sdk.PDFException
| Constructor. More...
| XFADoc (XFADoc other)
| Constructor, with another XFA document object. More...
synchronized void | delete ()
| Clean up related C++ resources immediately. More...
boolean | exportData (FileWriterCallback stream, int export_type) throws com.foxit.sdk.PDFException
| Export data to a com.foxit.sdk.common.fxcrt.FileWriterCallback object. More...
boolean | exportData (String output_file_path, int export_type) throws com.foxit.sdk.PDFException
| Export data to a file. More...
void | flattenTo (StreamCallback stream) throws com.foxit.sdk.PDFException
| Flatten current XFA document to a file stream. More...
void | flattenTo (String output_file_path) throws com.foxit.sdk.PDFException
| Flatten current XFA document to a file. More...
XFAPage | getPage (int page_index) throws com.foxit.sdk.PDFException
| Get XFA page by index. More...
int | getPageCount () throws com.foxit.sdk.PDFException
| Get XFA page count. More...
int | getType () throws com.foxit.sdk.PDFException
| Get the XFA document type. More...
XFAWidget | getWidgetByFullName (String full_name) throws com.foxit.sdk.PDFException
| Get the XFA widget which matches the specified full name. More...
boolean | importData (FileReaderCallback file_reader) throws com.foxit.sdk.PDFException
| Import data from a com.foxit.sdk.common.fxcrt.FileReaderCallback object. More...
boolean | importData (String file_path) throws com.foxit.sdk.PDFException
| Import data from an XML or XDP file. More...
boolean | isEmpty ()
| Check whether current object is empty or not. More...
void | killFocus () throws com.foxit.sdk.PDFException
| Kill the focus of XFA widget. More...
void | processEvent (int event_type) throws com.foxit.sdk.PDFException
| Process a kind of event for all the XFA widgets in current XFA document. More...
void | resetForm () throws com.foxit.sdk.PDFException
| Reset form. More...
void | setDocProviderCallback (DocProviderCallback doc_provider_callback)
| Set XFA document provider callback. More...
void | setFocus (XFAWidget xfa_widget) throws com.foxit.sdk.PDFException
| Set the focus of XFA widget. More...
void | setPDFPath (String pdf_file_path) throws com.foxit.sdk.PDFException
| Set the path of related PDF document. More...
Progressive | startLoad (PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to load content for current XFA document. More...

## Static Public Attributes
static final int | e_Dynamic = 0
| XFA document type: Dynamic.
static final int | e_EventTypeCalculate = 30
| This kind of event represents a calculate operation.
static final int | e_EventTypeChange = 4
| This kind of event is triggered when the user changes the field value.
static final int | e_EventTypeClick = 3
| This kind of event is triggered when the user clicks in the field.
static final int | e_EventTypeDocClose = 5
| This kind of event is triggered at the very end of processing if and only if all validations succeeded.
static final int | e_EventTypeDocReady = 6
| This kind of event is triggered before the document is rendered but after data binding.
static final int | e_EventTypeEnter = 7
| This kind of event is triggered when the field gains keyboard focus, whether caused by a user action (tabbing into the field or clicking on it with the mouse) or by a script programmatically setting the preSubmit event applies only to the Form DOM ($form).
static final int | e_EventTypeExit = 8
| This kind of event is triggered when keyboard focus is yielded from a field directly or indirectly within the subform to a field or other object outside the subform.
static final int | e_EventTypeFull = 9
| This kind of event is triggered when the user has entered the maximum allowed amount of content into the field and tries to enter more content.
static final int | e_EventTypeIndexChange = 10
| This kind of event is triggered to tell an object that it has just been added to an array or that its position in the array (its subscript) has changed.
static final int | e_EventTypeInitCalculate = 28
| This kind of event represents the first run calculate.
static final int | e_EventTypeInitialize = 11
| This kind of event is triggered after data binding is complete.
static final int | e_EventTypeInitVariables = 29
| This kind of event is not a real event activity, just sign script in variables.
static final int | e_EventTypeMouseDown = 12
| This kind of event is triggered when the mouse button is depressed at a moment and the mouse pointer is within the region.
static final int | e_EventTypeMouseEnter = 13
| This kind of event is triggered when the user moves the mouse pointer into the region of the field, without necessarily pressing the mouse button.
static final int | e_EventTypeMouseExit = 14
| This kind of event is triggered when user moves the mouse pointer out of the field, whether the mouse button is depressed or not.
static final int | e_EventTypeMouseUp = 15
| This kind of event is triggered when the mouse button is released at a moment and the mouse pointer is within the region.
static final int | e_EventTypePostExecute = 16
| This kind of event is triggered after a successful WSDL transaction, just after the reply to the request has been received and the received data is marshalled in the Connection Data DOM.
static final int | e_EventTypePostOpen = 17
| This kind of event is related to pre-open event for drop-down choice lists.
static final int | e_EventTypePostPrint = 1
| This kind of event is triggered just after the rendered form has been sent to the printer, spooler, or output destination.
static final int | e_EventTypePostSave = 18
| This kind of event is triggered just after the form has been written out in PDF or XDP format.
static final int | e_EventTypePostSign = 19
| This kind of event is triggered after successfully applying a signature.
static final int | e_EventTypePostSubmit = 20
| This kind of event is triggered just after the returned data has been marshalled in the Connection Data DOM.
static final int | e_EventTypePreExecute = 21
| This kind of event is triggered when a request is sent to a web service via WSDL, just after the data has been marshalled in the Connection Data DOM but before the request has been sent.
static final int | e_EventTypePreOpen = 22
| This kind of event applies only to drop-down choice lists for which open="userControl" or open="onEntry". The event is intended to trigger scripts that add choices to and remove choices from the choice list.
static final int | e_EventTypePrePrint = 2
| This kind of event is triggered just before the rendering for printing begins.
static final int | e_EventTypePreSave = 23
| This kind of event is triggered just before the form data is written out in PDF or XDP format.
static final int | e_EventTypePreSign = 24
| This kind of event is triggered when a signature is about to be applied.
static final int | e_EventTypePreSubmit = 25
| This kind of event is triggered just after the data has been marshalled in the Connection Data DOM but before validation and before the data is submitted to the host.
static final int | e_EventTypeReady = 26
| This kind of event is triggered after an XFA DOM has finished loading.
static final int | e_EventTypeUnknown = 0
| Event type: Unknown.
static final int | e_EventTypeValidate = 31
| This kind of event represents a validate operation.
static final int | e_EventTypeValidationState = 27
| This kind of event is triggered whenever the validation state of the target changes.
static final int | e_ExportDataTypeStaticXDP = 1
| Type of exported data: Static XDP.
static final int | e_ExportDataTypeXDP = 2
| Type of exported data: XDP.
static final int | e_ExportDataTypeXML = 0
| Type of exported data: XML.
static final int | e_Static = 1
| XFA document type: Static.
static final int | e_XDP = 2
| 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 common.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 com.foxit.sdk.pdf.TextSearch object with XFADoc object.

See also
  com.foxit.sdk.pdf.TextSearch

## Constructor & Destructor Documentation

## ◆ XFADoc() [1/3]

com.foxit.sdk.addon.xfa.XFADoc.XFADoc | ( | PDFDoc | document,
|  | DocProviderCallback | xfa_doc_provider_handler
| ) |  | throws com.foxit.sdk.PDFException

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 common.Library.initialize , that means user has no right in using XFA related functions and this constructor will throw exception com.foxit.sdk.common.Constants.e_ErrNoXFAModuleRight .

## ◆ XFADoc() [2/3]

com.foxit.sdk.addon.xfa.XFADoc.XFADoc | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException

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 com.foxit.sdk.common.Constants.e_ErrNoXFAModuleRight .

## ◆ XFADoc() [3/3]

com.foxit.sdk.addon.xfa.XFADoc.XFADoc | ( | XFADoc | other | ) |

Constructor, with another XFA document object.

Parameters

  [in] | other | Another XFA document object

## Member Function Documentation

## ◆ delete()

synchronized void com.foxit.sdk.addon.xfa.XFADoc.delete | ( |  | ) |

Clean up related C++ resources immediately.

Returns
  None.

Note
  Once this function is called, current object cannot be used anymore.

Reimplemented from com.foxit.sdk.common.Base.

## ◆ exportData() [1/2]

boolean com.foxit.sdk.addon.xfa.XFADoc.exportData | ( | FileWriterCallback | stream,
|  | int | export_type
| ) |  | throws com.foxit.sdk.PDFException

Export data to a com.foxit.sdk.common.fxcrt.FileWriterCallback object.

Parameters

  [in] | stream | A foxit::common::file::WriterCallback object which is implemented by user to save the exported data.
  [in] | export_type | Export type. Please refer to values starting from com.foxit.sdk.addon.xfa.XFADoc.e_ExportDataTypeXML and this should be one of these values.

Returns
  true means success, while false means failure.

## ◆ exportData() [2/2]

bool com.foxit.sdk.addon.xfa.XFADoc.exportData | ( | String | output_file_path,
|  | int | export_type
| ) |  | throws com.foxit.sdk.PDFException

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 com.foxit.sdk.addon.xfa.XFADoc.e_ExportDataTypeXML and this should be one of these values.

Returns
  true means success, while false means failure.

## ◆ flattenTo() [1/2]

void com.foxit.sdk.addon.xfa.XFADoc.flattenTo | ( | StreamCallback | stream | ) | throws com.foxit.sdk.PDFException

Flatten current XFA document to a file stream.

Parameters

  [in] | stream | A com.foxit.sdk.common.fxcrt.StreamCallback object which is implemented by user to save the flattened result.

Returns
  None.

## ◆ flattenTo() [2/2]

void com.foxit.sdk.addon.xfa.XFADoc.flattenTo | ( | String | output_file_path | ) | throws com.foxit.sdk.PDFException

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.

## ◆ getPage()

XFAPage com.foxit.sdk.addon.xfa.XFADoc.getPage | ( | int | page_index | ) | throws com.foxit.sdk.PDFException

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()

int com.foxit.sdk.addon.xfa.XFADoc.getPageCount | ( |  | ) | throws com.foxit.sdk.PDFException

Get XFA page count.

Returns
  Page count.

## ◆ getType()

int com.foxit.sdk.addon.xfa.XFADoc.getType | ( |  | ) | throws com.foxit.sdk.PDFException

Get the XFA document type.

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

## ◆ getWidgetByFullName()

XFAWidget com.foxit.sdk.addon.xfa.XFADoc.getWidgetByFullName | ( | String | full_name | ) | throws com.foxit.sdk.PDFException

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 com.foxit.sdk.addon.xfa.XFAWidget.e_WidgetNameTypeFullName in previous process.

Returns
  An XFA Widget object.

## ◆ importData() [1/2]

boolean com.foxit.sdk.addon.xfa.XFADoc.importData | ( | FileReaderCallback | file_reader | ) | throws com.foxit.sdk.PDFException

Import data from a com.foxit.sdk.common.fxcrt.FileReaderCallback object.

Parameters

  [in] | file_reader | A com.foxit.sdk.common.fxcrt.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.

## ◆ importData() [2/2]

bool com.foxit.sdk.addon.xfa.XFADoc.importData | ( | String | file_path | ) | throws com.foxit.sdk.PDFException

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.

## ◆ isEmpty()

boolean com.foxit.sdk.addon.xfa.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()

void com.foxit.sdk.addon.xfa.XFADoc.killFocus | ( |  | ) | throws com.foxit.sdk.PDFException

Kill the focus of XFA widget.

Returns
  None.

## ◆ processEvent()

void com.foxit.sdk.addon.xfa.XFADoc.processEvent | ( | int | event_type | ) | throws com.foxit.sdk.PDFException

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 com.foxit.sdk.addon.xfa.XFADoc.e_EventTypePostPrint and this should be one of these values except com.foxit.sdk.addon.xfa.XFADoc.e_EventTypeUnknown . Currently, only com.foxit.sdk.addon.xfa.XFADoc.e_EventTypePostPrint and com.foxit.sdk.addon.xfa.XFADoc.e_EventTypePrePrint are supported.

Returns
  None.

## ◆ resetForm()

void com.foxit.sdk.addon.xfa.XFADoc.resetForm | ( |  | ) | throws com.foxit.sdk.PDFException

Reset form.

Returns
  None.

## ◆ setDocProviderCallback()

void com.foxit.sdk.addon.xfa.XFADoc.setDocProviderCallback | ( | DocProviderCallback | 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()

void com.foxit.sdk.addon.xfa.XFADoc.setFocus | ( | XFAWidget | xfa_widget | ) | throws com.foxit.sdk.PDFException

Set the focus of XFA widget.

Parameters

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

Returns
  None.

## ◆ setPDFPath()

void com.foxit.sdk.addon.xfa.XFADoc.setPDFPath | ( | String | pdf_file_path | ) | throws com.foxit.sdk.PDFException

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()

Progressive com.foxit.sdk.addon.xfa.XFADoc.startLoad | ( | PauseCallback | pause | ) | throws com.foxit.sdk.PDFException

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 common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.