Foxit PDF SDK
fsdk.XFADoc Class Reference

Public Member Functions

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 fsdk.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...
 

Detailed Description

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

See also
fsdk.TextSearch

Member Function Documentation

◆ ExportData()

def fsdk.XFADoc.ExportData (   output_file_path,
  export_type 
)

Export data to a file.

Export data to a fsdk.FileWriterCallback object.

Parameters
[in]output_file_pathA file path, to which data will be exported to.
[in]export_typeExport type. Please refer to values starting from fsdk.XFADocE_ExportDataTypeXML and this should be one of these values.
Returns
true means success, while false means failure.
Parameters
[in]streamA foxit::common::file::WriterCallback object which is implemented by user to save the exported data.
[in]export_typeExport type. Please refer to values starting from fsdk.XFADocE_ExportDataTypeXML and this should be one of these values.
Returns
true means success, while false means failure.

◆ FlattenTo() [1/2]

def fsdk.XFADoc.FlattenTo (   output_file_path)

Flatten current XFA document to a file.

Parameters
[in]output_file_pathA file path, to which the flattening result will be saved.
Returns
None.

◆ FlattenTo() [2/2]

def fsdk.XFADoc.FlattenTo (   stream)

Flatten current XFA document to a file stream.

Parameters
[in]streamA fsdk.StreamCallback object which is implemented by user to save the flattened result.
Returns
None.

◆ GetPage()

def fsdk.XFADoc.GetPage (   page_index)

Get XFA page by index.

Parameters
[in]page_indexThe page index. Valid range: from 0 to (count-1). count is returned by function fsdk.XFADoc.GetPageCount .
Returns
The XFA page.

◆ GetPageCount()

def fsdk.XFADoc.GetPageCount ( )

Get XFA page count.

Returns
Page count.

◆ GetType()

def fsdk.XFADoc.GetType ( )

Get the XFA document type.

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

◆ GetWidgetByFullName()

def fsdk.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 fsdk.XFAPage.GetWidgetByFullName to get the matched XFA widget in an XFA page.

Parameters
[in]full_nameAn XFA widget's full name. It should not be an empty string. XFA widget's full name can be retrieved by function fsdk.XFAWidget.GetName with type fsdk.XFAWidgetE_WidgetNameTypeFullName in previous process.
Returns
An XFA Widget object.

◆ ImportData() [1/2]

def fsdk.XFADoc.ImportData (   file_path)

Import data from an XML or XDP file.

Parameters
[in]file_pathA 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 fsdk.XFADoc.ImportData (   file_reader)

Import data from a fsdk.FileReaderCallback object.

Parameters
[in]file_readerA fsdk.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 fsdk.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 fsdk.XFADoc.KillFocus ( )

Kill the focus of XFA widget.

Returns
None.

◆ ProcessEvent()

def fsdk.XFADoc.ProcessEvent (   event_type)

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

Parameters
[in]event_typeAn event type. Please refer to values starting from fsdk.XFADocE_EventTypePostPrint and this should be one of these values except fsdk.XFADocE_EventTypeUnknown .
Returns
None.

◆ ResetForm()

def fsdk.XFADoc.ResetForm ( )

Reset form.

Returns
None.

◆ SetDocProviderCallback()

def fsdk.XFADoc.SetDocProviderCallback (   doc_provider_callback)

Set XFA document provider callback.

Parameters
[in]doc_provider_callbackAn 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 fsdk.XFADoc.SetFocus (   xfa_widget)

Set the focus of XFA widget.

Parameters
[in]xfa_widgetAn XFA widget which would be focused.
Returns
None.

◆ SetPDFPath()

def fsdk.XFADoc.SetPDFPath (   pdf_file_path)

Set the path of related PDF document.

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

Parameters
[in]pdf_file_pathThe 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 fsdk.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]pausePause 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 fsdk.Progressive.GetRateOfProgress . If the rate is not 100 yet, call function fsdk.Progressive.Continue to continue the progress until the progress is finished.