TextFragmentAbsorber
Overview
TextFragmentAbsorber is a class in Aspose.PDF FOSS for Python.
Absorbs text fragments from a PDF page or document.
This class provides 5 methods for working with TextFragmentAbsorber objects in Python programs.
Available methods include: __init__, apply_for_all_fragments, remove_all_text, reset, visit.
All public members are accessible to any Python application after installing the Aspose.PDF FOSS for Python package.
Properties: errors, has_errors, phrase, regex_results, text_fragments, text_replace_options, and 1 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
text_fragments | list[TextFragment] | Read | List of :class:TextFragment objects found by the last visit. |
regex_results | list[RegexResult] | Read | List of :class:RegexResult objects (populated on regex search). |
errors | list[Any] | Read | Errors collected during the last visit, if any. |
phrase | str | None | Read | Gets the phrase. |
text_search_options | TextSearchOptions | Read | Gets the text search options. |
text_replace_options | Any | None | Read | Gets the text replace options. |
has_errors | bool | Read | Gets the has errors. |
Methods
| Signature | Description |
|---|---|
__init__(phrase: str | None, text_search_options: TextSearchOptions | None, text_replace_options: Any | None) | Calls init(phrase, text_search_options, text_replace_options) on this TextFragmentAbsorber instance. |
visit(page_or_doc: Any) | Process page_or_doc and collect matching text fragments. |
reset() | Clear all collected fragments, regex results and errors. |
remove_all_text() | Remove all collected text fragments (alias for reset without clearing errors). |
apply_for_all_fragments(action: Callable[[TextFragment], Any]) → list[Any] | Apply action to every collected fragment and return the results. |