Foxit PDF SDK

Public Member Functions | List of all members
FoxitPDFSDKPython3.TextSearchReplace Class Reference
Inheritance diagram for FoxitPDFSDKPython3.TextSearchReplace:

## Public Member Functions
def | TextSearchReplace (doc)
| Constructor. More...
def | TextSearchReplace (other)
| Constructor, with another text search replace object. More...
def | IsEmpty ()
| Check whether current object is empty or not. More...
def | ReplaceNext (replace_text)
| Replace next text with replacing text. More...
def | ReplacePrev (replace_text)
| Replace previous text with replacing text. More...
def | SetPattern (keywords, page_index, find_option)
| Set keywords and page index to do searching and replacing. More...
def | SetReplaceCallback (replace_callback)
| 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 FoxitPDFSDKPython3.Library.Initialize with a key including "AdvEdit" module.

See also
  FoxitPDFSDKPython3.Library

## Constructor & Destructor Documentation

## ◆ TextSearchReplace() [1/2]

def FoxitPDFSDKPython3.TextSearchReplace.TextSearchReplace | ( |  | doc | ) |

Constructor.

Parameters

  [in] | doc | A 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]

def FoxitPDFSDKPython3.TextSearchReplace.TextSearchReplace | ( |  | other | ) |

Constructor, with another text search replace object.

Parameters

  [in] | other | Another text search replace object.

## Member Function Documentation

## ◆ IsEmpty()

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

def FoxitPDFSDKPython3.TextSearchReplace.ReplaceNext | ( |  | replace_text | ) |

Replace next text with replacing text.

Parameters

  [in] | replace_text | The 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()

def FoxitPDFSDKPython3.TextSearchReplace.ReplacePrev | ( |  | replace_text | ) |

Replace previous text with replacing text.

Parameters

  [in] | replace_text | The 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()

def FoxitPDFSDKPython3.TextSearchReplace.SetPattern | ( |  | keywords,
|  |  | page_index,
|  |  | find_option
| ) |  |

Set keywords and page index to do searching and replacing.

Parameters

  [in] | keywords | The text content to be replaced. It should not be an empty string.
  [in] | page_index | Index of the page that will be searched and replaced.Valid range: from 0 to (count-1). count is returned by function FoxitPDFSDKPython3.PDFDoc.GetPageCount for PDF document. This is only used for FoxitPDFSDKPython3.TextSearchReplace.ReplacePrev and FoxitPDFSDKPython3.TextSearchReplace.ReplaceNext .
  [in] | find_option | The find option. It should be a valid find option object.

Returns
  true means success, while false means failure.

## ◆ SetReplaceCallback()

def FoxitPDFSDKPython3.TextSearchReplace.SetReplaceCallback | ( |  | replace_callback | ) |

Set replacing callback function.

Parameters

  [in] | replace_callback | The 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.