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

# PdfContentEditor

## Overview

`PdfContentEditor` is a class in Aspose.PDF FOSS for .NET.
Inherits from: `System.IDisposable`.

Facade for content-level editing: text replacement, link creation, image operations.

This class provides 83 methods for working with PdfContentEditor objects in .NET programs.
Available methods include: `AddDocumentAdditionalAction`, `AddDocumentAttachment`, `BindPdf`, `ChangeViewerPreference`, `Close`, `CreateApplicationLink`, `CreateBookmarksAction`, `CreateCaret`, `CreateCustomActionLink`, `CreateFileAttachment`, `CreateFreeText`, `CreateJavaScriptLink`, and 35 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `Document`, `DocumentClose`, `DocumentOpen`, `DocumentPrinted`, `DocumentSaved`, `DocumentWillPrint`, and 5 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Document` | `Document` | Read | The PDF document currently bound for editing. |
| `TextReplaceOptions` | `TextReplaceOptions` | Read/Write | Text-replacement options used by ReplaceText(string,string) family. |
| `TextEditOptions` | `TextEditOptions` | Read/Write | Text-edit options forwarded to the underlying replacement engine. |
| `TextSearchOptions` | `TextSearchOptions` | Read/Write | Text-search options used by the stateful text-replacement variants. |
| `ReplaceTextStrategy` | `ReplaceTextStrategy` | Read/Write | Strategy controlling how ReplaceText(string, string) matches (literal vs. |
| `DocumentOpen` | `string` | Read | Gets the document open. |
| `DocumentClose` | `string` | Read | Gets the document close. |
| `DocumentWillSave` | `string` | Read | Gets the document will save. |
| `DocumentSaved` | `string` | Read | Gets the document saved. |
| `DocumentWillPrint` | `string` | Read | Gets the document will print. |
| `DocumentPrinted` | `string` | Read | Gets the document printed. |

## Methods

| Signature | Description |
|-----------|-------------|
| `PdfContentEditor()` | Default ctor — bind a PDF later via BindPdf(string). |
| `PdfContentEditor(document: Document)` | Bind to an existing Document at construction. |
| `BindPdf(pdfData: byte[])` | Bind a PDF file for editing. |
| `BindPdf(inputFile: string)` | Bind a PDF file by path for editing. |
| `BindPdf(inputStream: Stream)` | Bind a PDF stream for editing. |
| `BindPdf(srcDoc: Document)` | Bind an in-memory PDF document for editing. |
| `Save()` | Save the bound document. |
| `Save(path: string)` | Save the bound document to a file path. |
| `Save(stream: Stream)` | Save the bound document to a stream. |
| `Close()` | Close the bound document. |
| `Dispose()` | Releases the bound document (equivalent to Close). |
| `GetViewerPreference()` | Get the current viewer preference flags as an integer bitmask. |
| `ChangeViewerPreference(viewerAttribution: int)` | Change the viewer preference. |
| `GetStamps(pageNumber: int)` | Get information about stamps on a page. |
| `DeleteStamp(pageNumber: int, index: int[])` | Delete stamps on a page by their 0-based indices. |
| `DeleteStampById(pageNumber: int, stampId: int)` | Delete a stamp by its stamp ID (the ID assigned via Stamp.StampId). |
| `DeleteStampByIds(pageNumber: int, stampIds: int[])` | Delete stamps by their stamp IDs. |
| `ReplaceText(srcString: string, destString: string)` | Replace text in the bound document according to ReplaceTextStrategy. |
| `ReplaceText(srcString: string, thePage: int, destString: string)` | Replace text on a specific page (1-based). |
| `ReplaceText(srcString: string, destString: string, textState: TextState)` | Replace text with explicit TextState formatting (font/size/colour). |
| `ReplaceText(srcString: string, thePage: int, destString: string, textState: TextState)` | Replace text on a specific page with explicit TextState. |
| `ReplaceText(srcString: string, destString: string, fontSize: int)` | Replace text and override the font size of the replacement run. |
| `ReplaceText(input: byte[], searchText: string, replaceText: string)` | Replace all occurrences of text across all pages. |
| `ReplaceText(input: byte[], searchText: string, replaceText: string, options: TextSearchOptions)` | Replace all occurrences of text across all pages using search options. |
| `ReplaceTextOnPage(input: byte[], pageNumber: int, searchText: string, replaceText: string)` | Replace text on a specific page (1-based). |
| `CreateLocalLink(input: byte[], rect: Rectangle, pageNumber: int, destinationPage: int)` | Create a local link annotation that navigates to a page in the same document. |
| `CreateWebLink(input: byte[], rect: Rectangle, pageNumber: int, url: string)` | Create a URI link annotation that opens a URL. |
| `CreateFreeText(input: byte[], rect: Rectangle, pageNumber: int, text: string, fontName: string?, fontSize: double)` | Create a free text annotation on a page. |
| `CreateText(input: byte[], rect: Rectangle, pageNumber: int, title: string, contents: string)` | Create a text (sticky note) annotation on a page. |
| `DeleteAnnotations(input: byte[], pageNumber: int)` | Delete all annotations on a specific page. |
| `DeleteAnnotations(input: byte[], pageNumber: int, annotationType: string)` | Delete annotations of a specific subtype from a page. |
| `ExtractText(input: byte[], pageNumber: int)` | Extract text from a specific page. |
| `ExtractText(input: byte[])` | Extract text from all pages. |
| `DrawCurve(lineInfo: LineInfo, page: int, annotRect: System.Drawing.Rectangle, annotContents: string)` | Overload that converts Rectangle to the PDF rectangle form and delegates. |
| `DrawCurve(lineInfo: LineInfo, pageNumber: int, rect: Rectangle, message: string?)` | Draw a curve (polyline) on a page. |
| `CreateLocalLink(rect: System.Drawing.Rectangle, desPage: int, originalPage: int)` | Calls CreateLocalLink on this PdfContentEditor instance. |
| `CreateLocalLink(rect: System.Drawing.Rectangle, desPage: int, originalPage: int, clr: System.Drawing.Color)` |  |
| `CreateLocalLink(rect: System.Drawing.Rectangle, desPage: int, originalPage: int, clr: System.Drawing.Color, actionName: System.Enum[])` |  |
| `CreateWebLink(rect: System.Drawing.Rectangle, url: string, originalPage: int)` | Calls CreateWebLink on this PdfContentEditor instance. |
| `CreateWebLink(rect: System.Drawing.Rectangle, url: string, originalPage: int, clr: System.Drawing.Color)` |  |
| `CreateWebLink(rect: System.Drawing.Rectangle, url: string, originalPage: int, clr: System.Drawing.Color, actionName: System.Enum[])` |  |
| `CreateApplicationLink(rect: System.Drawing.Rectangle, application: string, page: int)` | Calls CreateApplicationLink on this PdfContentEditor instance. |
| `CreateApplicationLink(rect: System.Drawing.Rectangle, application: string, page: int, clr: System.Drawing.Color)` |  |
| `CreateApplicationLink(rect: System.Drawing.Rectangle, application: string, page: int, clr: System.Drawing.Color, actionName: System.Enum[])` |  |
| `CreatePdfDocumentLink(rect: System.Drawing.Rectangle, remotePdf: string, originalPage: int, destinationPage: int)` | Calls CreatePdfDocumentLink on this PdfContentEditor instance. |
| `CreatePdfDocumentLink(rect: System.Drawing.Rectangle, remotePdf: string, originalPage: int, destinationPage: int, clr: System.Drawing.Color)` |  |
| `CreatePdfDocumentLink(rect: System.Drawing.Rectangle, remotePdf: string, originalPage: int, destinationPage: int, clr: System.Drawing.Color, actionName: System.Enum[])` |  |
| `CreateJavaScriptLink(code: string, rect: System.Drawing.Rectangle, originalPage: int, color: System.Drawing.Color)` | Calls CreateJavaScriptLink on this PdfContentEditor instance. |
| `CreateCustomActionLink(rect: System.Drawing.Rectangle, originalPage: int, color: System.Drawing.Color, actionName: System.Enum[])` | Calls CreateCustomActionLink on this PdfContentEditor instance. |
| `CreateFreeText(rect: System.Drawing.Rectangle, contents: string, page: int)` | Calls CreateFreeText on this PdfContentEditor instance. |
| `CreateText(rect: System.Drawing.Rectangle, title: string, contents: string, open: bool, icon: string, page: int)` | Calls CreateText on this PdfContentEditor instance. |
| `CreateCaret(page: int, annotRect: System.Drawing.Rectangle, caretRect: System.Drawing.Rectangle, symbol: string, annotContents: string, color: System.Drawing.Color)` | Calls CreateCaret on this PdfContentEditor instance. |
| `CreateMarkup(rect: System.Drawing.Rectangle, contents: string, type: int, page: int, clr: System.Drawing.Color)` | Calls CreateMarkup on this PdfContentEditor instance. |
| `CreateSquareCircle(rect: System.Drawing.Rectangle, contents: string, clr: System.Drawing.Color, square: bool, page: int, borderWidth: int)` | Calls CreateSquareCircle on this PdfContentEditor instance. |
| `CreateLine(rect: System.Drawing.Rectangle, contents: string, x1: float, y1: float, x2: float, y2: float, page: int, border: int, clr: System.Drawing.Color, borderStyle: string, dashArray: int[], LEArray: string[])` | Calls CreateLine on this PdfContentEditor instance. |
| `CreatePolygon(lineInfo: LineInfo, page: int, annotRect: System.Drawing.Rectangle, annotContents: string)` | Calls CreatePolygon on this PdfContentEditor instance. |
| `CreatePolyLine(lineInfo: LineInfo, page: int, annotRect: System.Drawing.Rectangle, annotContents: string)` | Calls CreatePolyLine on this PdfContentEditor instance. |
| `CreatePopup(rect: System.Drawing.Rectangle, contents: string, open: bool, page: int)` | Calls CreatePopup on this PdfContentEditor instance. |
| `CreateRubberStamp(page: int, annotRect: System.Drawing.Rectangle, annotContents: string, color: System.Drawing.Color, appearanceFile: string)` | Calls CreateRubberStamp on this PdfContentEditor instance. |
| `CreateRubberStamp(page: int, annotRect: System.Drawing.Rectangle, annotContents: string, color: System.Drawing.Color, appearanceStream: Stream)` |  |
| `CreateRubberStamp(page: int, annotRect: System.Drawing.Rectangle, icon: string, annotContents: string, color: System.Drawing.Color)` |  |
| `CreateMovie(rect: System.Drawing.Rectangle, filePath: string, page: int)` | Calls CreateMovie on this PdfContentEditor instance. |
| `CreateSound(rect: System.Drawing.Rectangle, filePath: string, name: string, page: int, rate: string)` | Calls CreateSound on this PdfContentEditor instance. |
| `CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, filePath: string, page: int, name: string)` | Calls CreateFileAttachment on this PdfContentEditor instance. |
| `CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, filePath: string, page: int, name: string, opacity: double)` |  |
| `CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, attachmentStream: Stream, attachmentName: string, page: int, name: string)` |  |
| `CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, attachmentStream: Stream, attachmentName: string, page: int, name: string, opacity: double)` |  |
| `CreateBookmarksAction(title: string, color: System.Drawing.Color, boldFlag: bool, italicFlag: bool, file: string, actionType: string, destination: string)` | Calls CreateBookmarksAction on this PdfContentEditor instance. |
| `AddDocumentAdditionalAction(eventType: string, code: string)` | Calls AddDocumentAdditionalAction on this PdfContentEditor instance. |
| `RemoveDocumentOpenAction()` | Calls RemoveDocumentOpenAction on this PdfContentEditor instance. |
| `AddDocumentAttachment(fileAttachmentPath: string, description: string)` | Calls AddDocumentAttachment on this PdfContentEditor instance. |
| `AddDocumentAttachment(fileAttachmentStream: Stream, fileAttachmentName: string, description: string)` |  |
| `DeleteAttachments()` | Calls DeleteAttachments on this PdfContentEditor instance. |
| `ExtractLink()` | Calls ExtractLink on this PdfContentEditor instance. |
| `DeleteImage()` | Calls DeleteImage on this PdfContentEditor instance. |
| `DeleteImage(pageNumber: int, index: int[])` |  |
| `ReplaceImage(pageNumber: int, index: int, imageFile: string)` | Calls ReplaceImage on this PdfContentEditor instance. |
| `HideStampById(pageNumber: int, stampId: int)` | Calls HideStampById on this PdfContentEditor instance. |
| `ShowStampById(pageNumber: int, stampId: int)` | Show a previously-hidden stamp. |
| `DeleteStampById(stampId: int)` | Delete all stamps with the given stampId across every page. |
| `DeleteStampByIds(stampIds: int[])` | Delete all stamps whose ID is in stampIds across every page. |
| `MoveStamp(pageNumber: int, stampIndex: int, x: double, y: double)` | Calls MoveStamp on this PdfContentEditor instance. |
| `MoveStampById(pageNumber: int, stampId: int, x: double, y: double)` | Calls MoveStampById on this PdfContentEditor instance. |

## See Also

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