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

# TextReplacer

## Overview

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

Finds and replaces text in PDF content streams.

This class provides 5 methods for working with TextReplacer objects in .NET programs.
Available methods include: `Replace`, `ReplaceWithCrossOperator`.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `ReplaceFirstOnly`, `ReplacementCount`.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `ReplacementCount` | `int` | Read | Number of replacements made in the last Replace call. |
| `ReplaceFirstOnly` | `bool` | Read/Write | When true, stop after the first match. |

## Methods

| Signature | Description |
|-----------|-------------|
| `Replace(page: Page, search: string, replacement: string)` | Replace all occurrences of search with replacement in the given page's content stream(s). |
| `ReplaceWithCrossOperator(page: Page, search: string, replacement: string)` | Replace with cross-operator support enabled. |
| `Replace(page: Page, search: string, replacement: string, isRegex: bool)` | Replace occurrences of search with replacement in the given page's content stream(s). |
| `Replace(document: Document, search: string, replacement: string)` | Replace text across all pages of a document, including Form XObjects. |
| `Replace(document: Document, search: string, replacement: string, isRegex: bool)` | Replace text across all pages of a document, including Form XObjects. |

## See Also

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