Foxit PDF SDK

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

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

## Static Public Attributes
| e_Dynamic = _fsdk.XFADoc_e_Dynamic
| XFA document type: Dynamic.
| e_EventTypeCalculate = _fsdk.XFADoc_e_EventTypeCalculate
| This kind of event represents a calculate operation.
| e_EventTypeChange = _fsdk.XFADoc_e_EventTypeChange
| This kind of event is triggered when the user changes the field value.
| e_EventTypeClick = _fsdk.XFADoc_e_EventTypeClick
| This kind of event is triggered when the user clicks in the field.
| e_EventTypeDocClose = _fsdk.XFADoc_e_EventTypeDocClose
| This kind of event is triggered at the very end of processing if and only if all validations succeeded.
| e_EventTypeDocReady = _fsdk.XFADoc_e_EventTypeDocReady
| This kind of event is triggered before the document is rendered but after data binding.
| e_EventTypeEnter = _fsdk.XFADoc_e_EventTypeEnter
| 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).
| e_EventTypeExit = _fsdk.XFADoc_e_EventTypeExit
| 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.
| e_EventTypeFull = _fsdk.XFADoc_e_EventTypeFull
| 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.
| e_EventTypeIndexChange = _fsdk.XFADoc_e_EventTypeIndexChange
| 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.
| e_EventTypeInitCalculate = _fsdk.XFADoc_e_EventTypeInitCalculate
| This kind of event represents the first run calculate.
| e_EventTypeInitVariables = _fsdk.XFADoc_e_EventTypeInitVariables
| This kind of event is not a real event activity, just sign script in variables.
| e_EventTypeMouseDown = _fsdk.XFADoc_e_EventTypeMouseDown
| This kind of event is triggered when the mouse button is depressed at a moment and the mouse pointer is within the region.
| e_EventTypeMouseEnter = _fsdk.XFADoc_e_EventTypeMouseEnter
| 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.
| e_EventTypeMouseExit = _fsdk.XFADoc_e_EventTypeMouseExit
| This kind of event is triggered when user moves the mouse pointer out of the field, whether the mouse button is depressed or not.
| e_EventTypeMouseUp = _fsdk.XFADoc_e_EventTypeMouseUp
| This kind of event is triggered when the mouse button is released at a moment and the mouse pointer is within the region.
| e_EventTypePostExecute = _fsdk.XFADoc_e_EventTypePostExecute
| 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.
| e_EventTypePostOpen = _fsdk.XFADoc_e_EventTypePostOpen
| This kind of event is related to pre-open event for drop-down choice lists.
| e_EventTypePostPrint = _fsdk.XFADoc_e_EventTypePostPrint
| This kind of event is triggered just after the rendered form has been sent to the printer, spooler, or output destination.
| e_EventTypePostSave = _fsdk.XFADoc_e_EventTypePostSave
| This kind of event is triggered just after the form has been written out in PDF or XDP format.
| e_EventTypePostSign = _fsdk.XFADoc_e_EventTypePostSign
| This kind of event is triggered after successfully applying a signature.
| e_EventTypePostSubmit = _fsdk.XFADoc_e_EventTypePostSubmit
| This kind of event is triggered just after the returned data has been marshalled in the Connection Data DOM.
| e_EventTypePreExecute = _fsdk.XFADoc_e_EventTypePreExecute
| 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.
| e_EventTypePreOpen = _fsdk.XFADoc_e_EventTypePreOpen
| 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.
| e_EventTypePrePrint = _fsdk.XFADoc_e_EventTypePrePrint
| This kind of event is triggered just before the rendering for printing begins.
| e_EventTypePreSave = _fsdk.XFADoc_e_EventTypePreSave
| This kind of event is triggered just before the form data is written out in PDF or XDP format.
| e_EventTypePreSign = _fsdk.XFADoc_e_EventTypePreSign
| This kind of event is triggered when a signature is about to be applied.
| e_EventTypePreSubmit = _fsdk.XFADoc_e_EventTypePreSubmit
| 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.
| e_EventTypeReady = _fsdk.XFADoc_e_EventTypeReady
| This kind of event is triggered after an XFA DOM has finished loading.
| e_EventTypeUnknown = _fsdk.XFADoc_e_EventTypeUnknown
| Event type: Unknown.
| e_EventTypeValidate = _fsdk.XFADoc_e_EventTypeValidate
| This kind of event represents a validate operation.
| e_EventTypeValidationState = _fsdk.XFADoc_e_EventTypeValidationState
| This kind of event is triggered whenever the validation state of the target changes.
| e_ExportDataTypeStaticXDP = _fsdk.XFADoc_e_ExportDataTypeStaticXDP
| Type of exported data: Static XDP.
| e_ExportDataTypeXDP = _fsdk.XFADoc_e_ExportDataTypeXDP
| Type of exported data: XDP.
| e_ExportDataTypeXML = _fsdk.XFADoc_e_ExportDataTypeXML
| Type of exported data: XML.
| e_Static = _fsdk.XFADoc_e_Static
| XFA document type: Static.
| e_XDP = _fsdk.XFADoc_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 FoxitPDFSDKPython2.Library.RegisterXFAAppProviderCallback before using XFA moudle. For a newly constructed XFA object, please remember to call function FoxitPDFSDKPython2.XFADoc.StartLoad before using other functions in class XFA.
To search among an XFA document, please construct a FoxitPDFSDKPython2.TextSearch object with XFADoc object.

See also
  FoxitPDFSDKPython2.TextSearch

## Constructor & Destructor Documentation

## ◆ XFADoc() [1/2]

def FoxitPDFSDKPython2.XFADoc.XFADoc | ( |  | document | ) |

Constructor.

When constructing an XFADoc by this constructor successfully, user must set XFA document provider callback by function FoxitPDFSDKPython2.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 FoxitPDFSDKPython2.Library.Initialize , that means user has no right in using XFA related functions and this constructor will throw exception FoxitPDFSDKPython2.e_ErrNoXFAModuleRight .

## ◆ XFADoc() [2/2]

def FoxitPDFSDKPython2.XFADoc.XFADoc | ( |  | other | ) |

Constructor, with another XFA document object.

Parameters

  [in] | other | Another XFA document object

## Member Function Documentation

## ◆ ExportData()

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

Export data to a file.

Export data to a FoxitPDFSDKPython2.FileWriterCallback object.

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 FoxitPDFSDKPython2.XFADoc.e_ExportDataTypeXML and this should be one of these values.

Returns
  true means success, while false means failure.

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 FoxitPDFSDKPython2.XFADoc.e_ExportDataTypeXML and this should be one of these values.

Returns
  true means success, while false means failure.

## ◆ FlattenTo() [1/2]

def FoxitPDFSDKPython2.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/2]

def FoxitPDFSDKPython2.XFADoc.FlattenTo | ( |  | stream | ) |

Flatten current XFA document to a file stream.

Parameters

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

Returns
  None.

## ◆ GetPage()

def FoxitPDFSDKPython2.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 FoxitPDFSDKPython2.XFADoc.GetPageCount .

Returns
  The XFA page.

## ◆ GetPageCount()

def FoxitPDFSDKPython2.XFADoc.GetPageCount | ( |  | ) |

Get XFA page count.

Returns
  Page count.

## ◆ GetType()

def FoxitPDFSDKPython2.XFADoc.GetType | ( |  | ) |

Get the XFA document type.

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

## ◆ GetWidgetByFullName()

def FoxitPDFSDKPython2.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 FoxitPDFSDKPython2.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 FoxitPDFSDKPython2.XFAWidget.GetName with type FoxitPDFSDKPython2.XFAWidget.e_WidgetNameTypeFullName in previous process.

Returns
  An XFA Widget object.

## ◆ ImportData() [1/2]

def FoxitPDFSDKPython2.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/2]

def FoxitPDFSDKPython2.XFADoc.ImportData | ( |  | file_reader | ) |

Import data from a FoxitPDFSDKPython2.FileReaderCallback object.

Parameters

  [in] | file_reader | A FoxitPDFSDKPython2.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()

def FoxitPDFSDKPython2.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()

def FoxitPDFSDKPython2.XFADoc.KillFocus | ( |  | ) |

Kill the focus of XFA widget.

Returns
  None.

## ◆ ProcessEvent()

def FoxitPDFSDKPython2.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 FoxitPDFSDKPython2.XFADoc.e_EventTypePostPrint and this should be one of these values except FoxitPDFSDKPython2.XFADoc.e_EventTypeUnknown . Currently, only FoxitPDFSDKPython2.XFADoc.e_EventTypePostPrint and FoxitPDFSDKPython2.XFADoc.e_EventTypePrePrint are supported.

Returns
  None.

## ◆ ResetForm()

def FoxitPDFSDKPython2.XFADoc.ResetForm | ( |  | ) |

Reset form.

Returns
  None.

## ◆ SetDocProviderCallback()

def FoxitPDFSDKPython2.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()

def FoxitPDFSDKPython2.XFADoc.SetFocus | ( |  | xfa_widget | ) |

Set the focus of XFA widget.

Parameters

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

Returns
  None.

## ◆ SetPDFPath()

def FoxitPDFSDKPython2.XFADoc.SetPDFPath | ( |  | pdf_file_path | ) |

Set the path of related PDF document.

The PDF path will be used in function FoxitPDFSDKPython2.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()

def FoxitPDFSDKPython2.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 FoxitPDFSDKPython2.Progressive.GetRateOfProgress . If the rate is not 100 yet, call function FoxitPDFSDKPython2.Progressive.Continue to continue the progress until the progress is finished.