Foxit PDF SDK
com.foxit.sdk.addon.pageeditor.TextSearchReplace Class Reference
Inheritance diagram for com.foxit.sdk.addon.pageeditor.TextSearchReplace:
com.foxit.sdk.common.Base

Public Member Functions

 TextSearchReplace (PDFDoc doc) throws com.foxit.sdk.PDFException
 Constructor.
More...
 
 TextSearchReplace (TextSearchReplace other)
 Constructor, with another text search replace object.
More...
 
synchronized void delete ()
 Clean up related resources immediately. More...
 
boolean isEmpty ()
 Check whether current object is empty or not.
More...
 
boolean replaceNext (String replace_text) throws com.foxit.sdk.PDFException
 Replace next text with replacing text.
More...
 
boolean replacePrev (String replace_text) throws com.foxit.sdk.PDFException
 Replace previous text with replacing text.
More...
 
void setPattern (String keywords, int page_index, FindOption find_option) throws com.foxit.sdk.PDFException
 Set keywords and page index to do searching and replacing.
More...
 
void setReplaceCallback (ReplaceCallback replace_callback) throws com.foxit.sdk.PDFException
 Set replacing callback function.
More...
 

Detailed Description

This class can be used for searching and replacing text. Before using any class or methods in this module, please ensure Foxit PDF SDK has been initialized successfully by function common.Library.initialize with a key including "AdvEdit" module.

See also
com.foxit.sdk.common.Library

Constructor & Destructor Documentation

◆ TextSearchReplace() [1/2]

com.foxit.sdk.addon.pageeditor.TextSearchReplace.TextSearchReplace ( PDFDoc  doc) throws com.foxit.sdk.PDFException

Constructor.

Parameters
[in]docA valid PDF document object to be searched or replaced. Currently, Foxit PDF SDK does not support to do the replacing for dynamic XFA document.

This constructor is to construct a text search replace object.

◆ TextSearchReplace() [2/2]

com.foxit.sdk.addon.pageeditor.TextSearchReplace.TextSearchReplace ( TextSearchReplace  other)

Constructor, with another text search replace object.

Parameters
[in]otherAnother text search replace object.

Member Function Documentation

◆ delete()

synchronized void com.foxit.sdk.addon.pageeditor.TextSearchReplace.delete ( )

Clean up related resources immediately.

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

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

◆ isEmpty()

boolean com.foxit.sdk.addon.pageeditor.TextSearchReplace.isEmpty ( )

Check whether current object is empty or not.

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

Returns
true means that current object is empty, while false means not.

◆ replaceNext()

boolean com.foxit.sdk.addon.pageeditor.TextSearchReplace.replaceNext ( String  replace_text) throws com.foxit.sdk.PDFException

Replace next text with replacing text.

Parameters
[in]replace_textThe text to be replaced with. This should not be an empty string.
Returns
true means success, while false means that keywords is not found. It will still return true if users do not want to replace.

◆ replacePrev()

boolean com.foxit.sdk.addon.pageeditor.TextSearchReplace.replacePrev ( String  replace_text) throws com.foxit.sdk.PDFException

Replace previous text with replacing text.

Parameters
[in]replace_textThe text to be replaced with. This should not be an empty string.
Returns
true means success, while false means that keywords is not found. It will still return true if users do not want to replace.

◆ setPattern()

void com.foxit.sdk.addon.pageeditor.TextSearchReplace.setPattern ( String  keywords,
int  page_index,
FindOption  find_option 
) throws com.foxit.sdk.PDFException

Set keywords and page index to do searching and replacing.

Parameters
[in]keywordsThe text content to be replaced. It should not be an empty string.
[in]page_indexIndex of the page that will be searched and replaced.Valid range: from 0 to (count-1). count is returned by function PDFDoc.getPageCount for PDF document. This is only used for TextSearchReplace.replacePrev and TextSearchReplace.replaceNext .
[in]find_optionThe find option. It should be a valid find option object.
Returns
true means success, while false means failure.

◆ setReplaceCallback()

void com.foxit.sdk.addon.pageeditor.TextSearchReplace.setReplaceCallback ( ReplaceCallback  replace_callback) throws com.foxit.sdk.PDFException

Set replacing callback function.

Parameters
[in]replace_callbackThe callback object for replacing.This should be implemented by user and can be null. It means that the found text always needs to be replaced if it is null
Returns
None.