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

NameTypeAccessDescription
DocumentDocumentReadThe PDF document currently bound for editing.
TextReplaceOptionsTextReplaceOptionsRead/WriteText-replacement options used by ReplaceText(string,string) family.
TextEditOptionsTextEditOptionsRead/WriteText-edit options forwarded to the underlying replacement engine.
TextSearchOptionsTextSearchOptionsRead/WriteText-search options used by the stateful text-replacement variants.
ReplaceTextStrategyReplaceTextStrategyRead/WriteGets or sets the replace text strategy.
DocumentOpenstringReadGets the document open.
DocumentClosestringReadGets the document close.
DocumentWillSavestringReadGets the document will save.
DocumentSavedstringReadGets the document saved.
DocumentWillPrintstringReadGets the document will print.
DocumentPrintedstringReadGets the document printed.

Methods

SignatureDescription
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(rect, desPage, originalPage) on this PdfContentEditor instance.
CreateLocalLink(rect: System.Drawing.Rectangle, desPage: int, originalPage: int, clr: System.Drawing.Color)Calls CreateLocalLink(rect, desPage, originalPage, clr) on this PdfContentEditor instance.
CreateLocalLink(rect: System.Drawing.Rectangle, desPage: int, originalPage: int, clr: System.Drawing.Color, actionName: System.Enum[])Calls CreateLocalLink(rect, desPage, originalPage, clr, actionName) on this PdfContentEditor instance.
CreateWebLink(rect: System.Drawing.Rectangle, url: string, originalPage: int)Calls CreateWebLink(rect, url, originalPage) on this PdfContentEditor instance.
CreateWebLink(rect: System.Drawing.Rectangle, url: string, originalPage: int, clr: System.Drawing.Color)Calls CreateWebLink(rect, url, originalPage, clr) on this PdfContentEditor instance.
CreateWebLink(rect: System.Drawing.Rectangle, url: string, originalPage: int, clr: System.Drawing.Color, actionName: System.Enum[])Calls CreateWebLink(rect, url, originalPage, clr, actionName) on this PdfContentEditor instance.
CreateApplicationLink(rect: System.Drawing.Rectangle, application: string, page: int)Calls CreateApplicationLink(rect, application, page) on this PdfContentEditor instance.
CreateApplicationLink(rect: System.Drawing.Rectangle, application: string, page: int, clr: System.Drawing.Color)Calls CreateApplicationLink(rect, application, page, clr) on this PdfContentEditor instance.
CreateApplicationLink(rect: System.Drawing.Rectangle, application: string, page: int, clr: System.Drawing.Color, actionName: System.Enum[])Calls CreateApplicationLink(rect, application, page, clr, actionName) on this PdfContentEditor instance.
CreatePdfDocumentLink(rect: System.Drawing.Rectangle, remotePdf: string, originalPage: int, destinationPage: int)Calls CreatePdfDocumentLink(rect, remotePdf, originalPage, destinationPage) on this PdfContentEditor instance.
CreatePdfDocumentLink(rect: System.Drawing.Rectangle, remotePdf: string, originalPage: int, destinationPage: int, clr: System.Drawing.Color)Calls CreatePdfDocumentLink(rect, remotePdf, originalPage, destinationPage, clr) on this PdfContentEditor instance.
CreatePdfDocumentLink(rect: System.Drawing.Rectangle, remotePdf: string, originalPage: int, destinationPage: int, clr: System.Drawing.Color, actionName: System.Enum[])Calls CreatePdfDocumentLink(rect, remotePdf, originalPage, destinationPage, clr, actionName) on this PdfContentEditor instance.
CreateJavaScriptLink(code: string, rect: System.Drawing.Rectangle, originalPage: int, color: System.Drawing.Color)Calls CreateJavaScriptLink(code, rect, originalPage, color) on this PdfContentEditor instance.
CreateCustomActionLink(rect: System.Drawing.Rectangle, originalPage: int, color: System.Drawing.Color, actionName: System.Enum[])Calls CreateCustomActionLink(rect, originalPage, color, actionName) on this PdfContentEditor instance.
CreateFreeText(rect: System.Drawing.Rectangle, contents: string, page: int)Calls CreateFreeText(rect, contents, page) on this PdfContentEditor instance.
CreateText(rect: System.Drawing.Rectangle, title: string, contents: string, open: bool, icon: string, page: int)Calls CreateText(rect, title, contents, open, icon, page) 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(page, annotRect, caretRect, symbol, annotContents, color) on this PdfContentEditor instance.
CreateMarkup(rect: System.Drawing.Rectangle, contents: string, type: int, page: int, clr: System.Drawing.Color)Calls CreateMarkup(rect, contents, type, page, clr) on this PdfContentEditor instance.
CreateSquareCircle(rect: System.Drawing.Rectangle, contents: string, clr: System.Drawing.Color, square: bool, page: int, borderWidth: int)Calls CreateSquareCircle(rect, contents, clr, square, page, borderWidth) 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(rect, contents, x1, y1, x2, y2, page, border, clr, borderStyle, dashArray, LEArray) on this PdfContentEditor instance.
CreatePolygon(lineInfo: LineInfo, page: int, annotRect: System.Drawing.Rectangle, annotContents: string)Calls CreatePolygon(lineInfo, page, annotRect, annotContents) on this PdfContentEditor instance.
CreatePolyLine(lineInfo: LineInfo, page: int, annotRect: System.Drawing.Rectangle, annotContents: string)Calls CreatePolyLine(lineInfo, page, annotRect, annotContents) on this PdfContentEditor instance.
CreatePopup(rect: System.Drawing.Rectangle, contents: string, open: bool, page: int)Calls CreatePopup(rect, contents, open, page) on this PdfContentEditor instance.
CreateRubberStamp(page: int, annotRect: System.Drawing.Rectangle, annotContents: string, color: System.Drawing.Color, appearanceFile: string)Calls CreateRubberStamp(page, annotRect, annotContents, color, appearanceFile) on this PdfContentEditor instance.
CreateRubberStamp(page: int, annotRect: System.Drawing.Rectangle, annotContents: string, color: System.Drawing.Color, appearanceStream: Stream)Calls CreateRubberStamp(page, annotRect, annotContents, color, appearanceStream) on this PdfContentEditor instance.
CreateRubberStamp(page: int, annotRect: System.Drawing.Rectangle, icon: string, annotContents: string, color: System.Drawing.Color)Calls CreateRubberStamp(page, annotRect, icon, annotContents, color) on this PdfContentEditor instance.
CreateMovie(rect: System.Drawing.Rectangle, filePath: string, page: int)Calls CreateMovie(rect, filePath, page) on this PdfContentEditor instance.
CreateSound(rect: System.Drawing.Rectangle, filePath: string, name: string, page: int, rate: string)Calls CreateSound(rect, filePath, name, page, rate) on this PdfContentEditor instance.
CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, filePath: string, page: int, name: string)Calls CreateFileAttachment(rect, contents, filePath, page, name) on this PdfContentEditor instance.
CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, filePath: string, page: int, name: string, opacity: double)Calls CreateFileAttachment(rect, contents, filePath, page, name, opacity) on this PdfContentEditor instance.
CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, attachmentStream: Stream, attachmentName: string, page: int, name: string)Calls CreateFileAttachment(rect, contents, attachmentStream, attachmentName, page, name) on this PdfContentEditor instance.
CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, attachmentStream: Stream, attachmentName: string, page: int, name: string, opacity: double)Calls CreateFileAttachment(rect, contents, attachmentStream, attachmentName, page, name, opacity) on this PdfContentEditor instance.
CreateBookmarksAction(title: string, color: System.Drawing.Color, boldFlag: bool, italicFlag: bool, file: string, actionType: string, destination: string)Calls CreateBookmarksAction(title, color, boldFlag, italicFlag, file, actionType, destination) on this PdfContentEditor instance.
AddDocumentAdditionalAction(eventType: string, code: string)Calls AddDocumentAdditionalAction(eventType, code) on this PdfContentEditor instance.
RemoveDocumentOpenAction()Calls RemoveDocumentOpenAction on this PdfContentEditor instance.
AddDocumentAttachment(fileAttachmentPath: string, description: string)Calls AddDocumentAttachment(fileAttachmentPath, description) on this PdfContentEditor instance.
AddDocumentAttachment(fileAttachmentStream: Stream, fileAttachmentName: string, description: string)Calls AddDocumentAttachment(fileAttachmentStream, fileAttachmentName, description) on this PdfContentEditor instance.
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[])Calls DeleteImage(pageNumber, index) on this PdfContentEditor instance.
ReplaceImage(pageNumber: int, index: int, imageFile: string)Calls ReplaceImage(pageNumber, index, imageFile) on this PdfContentEditor instance.
HideStampById(pageNumber: int, stampId: int)Hide the stamp(s) with the given stampId on a page without removing them: the stamp’s drawing operators are kept but suppressed by an empty-clip prologue, and a %StampHidden=1 marker records the state so GetStamps reports Visible = false and ShowStampById can restore it.
ShowStampById(pageNumber: int, stampId: int)Show a previously-hidden stamp: remove the hidden marker and the empty-clip prologue so the stamp paints again.
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(pageNumber, stampIndex, x, y) on this PdfContentEditor instance.
MoveStampById(pageNumber: int, stampId: int, x: double, y: double)Calls MoveStampById(pageNumber, stampId, x, y) on this PdfContentEditor instance.

See Also

 English