Foxit PDF SDK
FSTextSearchReplace Class Reference
Inheritance diagram for FSTextSearchReplace:
FSBase

Instance Methods

(id) - initWithDoc:
 Constructor.
More...
 
(id) - initWithOther:
 Constructor, with another text search replace object.
More...
 
(BOOL) - isEmpty
 Check whether current object is empty or not.
More...
 
(BOOL) - replaceNext:
 Replace next text with replacing text.
More...
 
(BOOL) - replacePrev:
 Replace previous text with replacing text.
More...
 
(void) - setPattern:page_index:find_option:
 Set keywords and page index to do searching and replacing.
More...
 
(void) - setReplaceCallback:
 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 FSLibrary::initialize:key: with a key including "AdvEdit" module.

See also
FSLibrary

Method Documentation

◆ initWithDoc:()

- (id) initWithDoc: (FSPDFDoc*)  doc

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.

◆ initWithOther:()

- (id) initWithOther: (FSTextSearchReplace*)  other

Constructor, with another text search replace object.

Parameters
[in]otherAnother text search replace 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 that current object is empty, while NO means not.

◆ replaceNext:()

- (BOOL) replaceNext: (NSString *)  replace_text

Replace next text with replacing text.

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

◆ replacePrev:()

- (BOOL) replacePrev: (NSString *)  replace_text

Replace previous text with replacing text.

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

◆ setPattern:page_index:find_option:()

- (void) setPattern: (NSString *)  keywords
page_index: (int)  page_index
find_option: (FSFindOption*)  find_option 

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 FSPDFDoc::getPageCount for PDF document. This is only used for FSTextSearchReplace::replacePrev: and FSTextSearchReplace::replaceNext:.
[in]find_optionThe find option. It should be a valid find option object.
Returns
YES means success, while NO means failure.

◆ setReplaceCallback:()

- (void) setReplaceCallback: (id<FSReplaceCallback>)  replace_callback

Set replacing callback function.

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