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 declares 83 methods for PdfContentEditor objects in .NET programs. Available methods include: AddDocumentAdditionalAction, AddDocumentAttachment, BindPdf, ChangeViewerPreference, Close, CreateApplicationLink, CreateBookmarksAction, CreateCaret, CreateCustomActionLink, CreateFileAttachment, CreateFreeText, CreateJavaScriptLink, and 35 additional methods. 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 strategy that controls how ReplaceText matches text (literal or regular expression) and how many matches it replaces.
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
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.
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)Adds a link on page originalPage that jumps to page desPage.
CreateLocalLink(rect: System.Drawing.Rectangle, desPage: int, originalPage: int, clr: System.Drawing.Color)Adds a link with the given border color on page originalPage that jumps to page desPage.
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)Adds a link on page originalPage that opens the given URL.
CreateWebLink(rect: System.Drawing.Rectangle, url: string, originalPage: int, clr: System.Drawing.Color)Adds a link with the given border color on page originalPage that opens the given URL.
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)Adds a link with the given border color on page originalPage that runs the given JavaScript code when clicked.
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)Adds a free-text annotation showing the given text in 12-point Helvetica on the given page.
CreateText(rect: System.Drawing.Rectangle, title: string, contents: string, open: bool, icon: string, page: int)Adds a text (sticky note) annotation with the given title, contents, initial open state and icon name on the given page.
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[])Adds a line annotation from (x1, y1) to (x2, y2) on the given page, with the given border width, color, border style, dash pattern and line-ending styles (the first two entries of LEArray).
CreatePolygon(lineInfo: LineInfo, page: int, annotRect: System.Drawing.Rectangle, annotContents: string)Adds a polygon annotation on the given page whose vertices, color, width and dash pattern come from lineInfo.
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)Adds a top-level bookmark with the given title, color and bold/italic style.
AddDocumentAdditionalAction(eventType: string, code: string)Calls AddDocumentAdditionalAction(eventType, code) on this PdfContentEditor instance.
RemoveDocumentOpenAction()Calls RemoveDocumentOpenAction on this PdfContentEditor instance.
ExtractLink()Calls ExtractLink on this PdfContentEditor instance.
AddDocumentAttachment(fileAttachmentPath: string, description: string)Embeds the file at the given path as a document-level attachment, named after the file, with the given description.
AddDocumentAttachment(fileAttachmentStream: Stream, fileAttachmentName: string, description: string)Embeds the contents of the stream as a document-level attachment with the given name and description.
DeleteAttachments()Removes all document-level attachments (the embedded files name tree).
DeleteImage()Removes the first image found in the page resources, searching from the first page.
DeleteImage(pageNumber: int, index: int[])Removes images from the resources of the given page.
ReplaceImage(pageNumber: int, index: int, imageFile: string)Replaces the image at the given 1-based index on the given page with the JPEG file at imageFile.
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).
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.
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)Moves the stamp at the given 0-based index on the page so that its lower-left corner lands on (x, y) in points.
MoveStampById(pageNumber: int, stampId: int, x: double, y: double)Calls MoveStampById(pageNumber, stampId, x, y) on this PdfContentEditor instance.
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).
ExtractText(input: byte[], pageNumber: int)Extract text from a specific page.
ExtractText(input: byte[])Extract text from all pages.
GetViewerPreference()Get the current viewer preference flags as an integer bitmask.
ChangeViewerPreference(viewerAttribution: int)Change the viewer preference.

See Also

 English