---
Product: Aspose.PDF
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/net/TextFragmentAbsorber
---

# TextFragmentAbsorber

## Overview

`TextFragmentAbsorber` is a class in Aspose.PDF FOSS for .NET.

Searches for text fragments on PDF pages, optionally matching a search phrase.

This class provides 21 methods for working with TextFragmentAbsorber objects in .NET programs.
Available methods include: `ApplyForAllFragments`, `RemoveAllText`, `Reset`, `TextFragmentAbsorber`, `Visit`.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `Errors`, `ExtractionOptions`, `HasErrors`, `Phrase`, `RegexResults`, `Text`, and 4 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `TextEditOptions` | `TextEditOptions` | Read/Write | Edit options applied during text replacement / font substitution. |
| `TextFragments` | `TextFragmentCollection` | Read/Write | Found text fragments. |
| `Errors` | `List` | Read | Diagnostics emitted while extracting text. |
| `HasErrors` | `bool` | Read | True when Errors has at least one entry. |
| `RegexResults` | `Dictionary` | Read | Per-regex fragment groups when constructed via the Regex[] ctor; empty otherwise. |
| `Phrase` | `string?` | Read/Write | Gets or sets the search phrase. |
| `Text` | `string` | Read | Gets the concatenated text of all found fragments. |
| `ExtractionOptions` | `TextExtractionOptions` | Read/Write | Gets or sets the text extraction options. |
| `TextSearchOptions` | `TextSearchOptions` | Read/Write | Gets or sets the text search options. |
| `TextReplaceOptions` | `TextReplaceOptions` | Read/Write | Gets or sets text replace options for controlling replacement behavior. |

## Methods

| Signature | Description |
|-----------|-------------|
| `TextFragmentAbsorber()` | Create an absorber that collects all text fragments. |
| `TextFragmentAbsorber(searchPhrase: string, isRegex: bool)` | Create an absorber that searches for a specific phrase. |
| `TextFragmentAbsorber(phrase: string)` | Create an absorber for a single literal phrase. |
| `TextFragmentAbsorber(phrase: string, textEditOptions: TextEditOptions)` | Create an absorber for a phrase with edit options. |
| `TextFragmentAbsorber(phrase: string, textSearchOptions: TextSearchOptions)` | Create an absorber that searches for a specific phrase with search options. |
| `TextFragmentAbsorber(phrase: string, textSearchOptions: TextSearchOptions, textEditOptions: TextEditOptions)` | Create an absorber for a phrase with search + edit options. |
| `TextFragmentAbsorber(regex: System.Text.RegularExpressions.Regex, textEditOptions: TextEditOptions)` | Create an absorber from a regex with edit options. |
| `TextFragmentAbsorber(regex: System.Text.RegularExpressions.Regex, textSearchOptions: TextSearchOptions)` | Create an absorber from a regex with search options. |
| `TextFragmentAbsorber(regexes: System.Text.RegularExpressions.Regex[], textSearchOptions: TextSearchOptions)` | Create an absorber from an array of regexes; each compiles into its own RegexResults entry. |
| `TextFragmentAbsorber(regex: System.Text.RegularExpressions.Regex)` | Create an absorber that searches using a precompiled .NET Regex. |
| `TextFragmentAbsorber(textEditOptions: TextEditOptions)` | Create an absorber configured with the given edit options. |
| `Visit(page: Page)` | Visit a page and extract/search text fragments. |
| `Visit(xForm: XForm)` | Search the content stream of a Form XObject for text fragments. |
| `Visit(pdf: Document)` | Visit all pages of a document. |
| `ApplyForAllFragments(font: Font)` | Apply the supplied font to every absorbed fragment. |
| `ApplyForAllFragments(font: Font, fontSize: float)` | Apply the supplied font + size to every absorbed fragment. |
| `ApplyForAllFragments(fontSize: float)` | Apply the supplied font size to every absorbed fragment. |
| `RemoveAllText(document: Aspose.Pdf.Document)` | Replace every fragment's text with the empty string across every page in the document. |
| `RemoveAllText(page: Aspose.Pdf.Page)` | Replace every fragment's text with the empty string on the given page. |
| `RemoveAllText(page: Aspose.Pdf.Page, rect: Aspose.Pdf.Rectangle)` | Replace every fragment's text with the empty string on the given page, restricted to rect. |
| `Reset()` | Clear absorbed fragments, errors, and per-regex results. |

## See Also

- [Aspose.PDF for .NET — Enterprise API Reference](https://reference.aspose.com/pdf/net/)