Foxit PDF SDK

Instance Methods | List of all members
FSXFADoc Class Reference
Inheritance diagram for FSXFADoc:

## Instance Methods
(BOOL) | - exportData:export_type:
| Export data to a file. More...
(BOOL) | - exportDataWithStreamCallback:export_type:
| Export data to a FSFileWriterCallback object. More...
(void) | - flattenTo:
| Flatten current XFA document to a file. More...
(void) | - flattenToWithStreamCallback:
| Flatten current XFA document to a file stream. More...
(FSXFAPage *) | - getPage:
| Get XFA page by index. More...
(int) | - getPageCount
| Get XFA page count. More...
(FSXFADocType) | - getType
| Get the XFA document type. More...
(FSXFAWidget *) | - getWidgetByFullName:
| Get the XFA widget which matches the specified full name. More...
(BOOL) | - importData:
| Import data from an XML or XDP file. More...
(BOOL) | - importDataWithReaderCallback:
| Import data from a FSFileReaderCallback object. More...
(id) | - initWithDocument:
| Constructor. More...
(id) | - initWithDocument:xfa_doc_provider_handler:
| Constructor. More...
(id) | - initWithOther:
| Constructor, with another XFA document object. More...
(BOOL) | - isEmpty
| Check whether current object is empty or not. More...
(void) | - killFocus
| Kill the focus of XFA widget. More...
(void) | - processEvent:
| Process a kind of event for all the XFA widgets in current XFA document. More...
(void) | - resetForm
| Reset form. More...
(void) | - setDocProviderCallback:
| Set XFA document provider callback. More...
(void) | - setFocus:
| Set the focus of XFA widget. More...
(void) | - setPDFPath:
| Set the path of related PDF document. More...
(FSProgressive *) | - startLoad:
| Start to load content for current XFA document. More...

## Detailed Description

Class FSXFADoc is constructed from a loaded PDF document object, in order to access XFA content more clearly. User must call FSLibrary::registerXFAAppProviderCallback: before using XFA moudle. For a newly constructed XFA object, please remember to call function FSXFADoc::startLoad: before using other functions in class XFA.
To search among an XFA document, please construct a FSTextSearch object with FSXFADoc object.

See also
  FSTextSearch

## Method Documentation

## ◆ exportData:export_type:()

- (bool) exportData: |  | (NSString *) | output_file_path
export_type: |  | (FSXFADocExportDataType) | 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 FSXFADocExportDataTypeXML and this should be one of these values.

Returns
  YES means success, while NO means failure.

## ◆ exportDataWithStreamCallback:export_type:()

- (BOOL) exportDataWithStreamCallback: |  | (id<FSFileWriterCallback>) | stream
export_type: |  | (FSXFADocExportDataType) | export_type

Export data to a FSFileWriterCallback 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 FSXFADocExportDataTypeXML and this should be one of these values.

Returns
  YES means success, while NO means failure.

## ◆ flattenTo:()

- (void) flattenTo: |  | (NSString *) | 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.

## ◆ flattenToWithStreamCallback:()

- (void) flattenToWithStreamCallback: |  | (id<FSFileStreamCallback>) | stream |

Flatten current XFA document to a file stream.

Parameters

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

Returns
  None.

## ◆ getPage:()

- (FSXFAPage *) getPage: |  | (int) | 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 FSXFADoc::getPageCount.

Returns
  The XFA page.

## ◆ getPageCount()

- (int) getPageCount |  |  |

Get XFA page count.

Returns
  Page count.

## ◆ getType()

- (FSXFADocType) getType |  |  |

Get the XFA document type.

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

## ◆ getWidgetByFullName:()

- (FSXFAWidget *) getWidgetByFullName: |  | (NSString *) | 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 FSXFAPage::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 FSXFAWidget::getName: with type FSXFAWidgetWidgetNameTypeFullName in previous process.

Returns
  An XFA Widget object.

## ◆ importData:()

- (BOOL) importData: |  | (NSString *) | 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
  YES means success, while NO means failure.

## ◆ importDataWithReaderCallback:()

- (BOOL) importDataWithReaderCallback: |  | (id<FSFileReaderCallback>) | file_reader |

Import data from a FSFileReaderCallback object.

Parameters

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

Returns
  YES means success, while NO means failure.

## ◆ initWithDocument:()

- (id) initWithDocument: |  | (FSPDFDoc*) | document |

Constructor.

When constructing an XFADoc by this constructor successfully, user must set XFA document provider callback by function FSXFADoc::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 FSLibrary::initialize:key:, that means user has no right in using XFA related functions and this constructor will throw exception FSErrNoXFAModuleRight.

## ◆ initWithDocument:xfa_doc_provider_handler:()

- (id) initWithDocument: |  | (FSPDFDoc*) | document
xfa_doc_provider_handler: |  | (id<FSDocProviderCallback>) | 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 . It should not be nil. 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 FSLibrary::initialize:key:, that means user has no right in using XFA related functions and this constructor will throw exception FSErrNoXFAModuleRight.

## ◆ initWithOther:()

- (id) initWithOther: |  | (FSXFADoc*) | other |

Constructor, with another XFA document object.

Parameters

  [in] | other | Another XFA document object

## ◆ isEmpty()

- (BOOL) isEmpty |  |  |

Check whether current object is empty or not.

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

Returns
  YES means current object is empty, while NO means not.

## ◆ killFocus()

- (void) killFocus |  |  |

Kill the focus of XFA widget.

Returns
  None.

## ◆ processEvent:()

- (void) processEvent: |  | (FSXFADocEventType) | 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 FSXFADocEventTypePostPrint and this should be one of these values except FSXFADocEventTypeUnknown. Currently, only FSXFADocEventTypePostPrint and FSXFADocEventTypePrePrint are supported.

Returns
  None.

## ◆ resetForm()

- (void) resetForm |  |  |

Reset form.

Returns
  None.

## ◆ setDocProviderCallback:()

- (void) setDocProviderCallback: |  | (id<FSDocProviderCallback>) | 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 . It should not be nil. User should ensure this callback object is kept valid until related PDF document is released.

Returns
  None.

## ◆ setFocus:()

- (void) setFocus: |  | (FSXFAWidget*) | xfa_widget |

Set the focus of XFA widget.

Parameters

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

Returns
  None.

## ◆ setPDFPath:()

- (void) setPDFPath: |  | (NSString *) | pdf_file_path |

Set the path of related PDF document.

The PDF path will be used in function FSXFADoc::exportData:export_type:, 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:()

- (FSProgressive *) startLoad: |  | (id<FSPauseCallback>) | 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 nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user. Default value: nil.

Returns
  A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.