PdfContentEditor

PdfContentEditor

概述

PdfContentEditor 是 Aspose.PDF FOSS 中用于 .NET 的一个类。继承自:System.IDisposable。

内容级编辑的 Facade:文本替换、链接创建、图像操作。

此类提供 83 个方法,用于在 .NET 程序中处理 PdfContentEditor 对象。可用的方法包括:AddDocumentAdditionalAction、AddDocumentAttachment、BindPdf、ChangeViewerPreference、Close、CreateApplicationLink、CreateBookmarksAction、CreateCaret、CreateCustomActionLink、CreateFileAttachment、CreateFreeText、CreateJavaScriptLink,以及另外 35 个方法。所有公共成员在安装了 Aspose.PDF FOSS for .NET 包后,可供任何 .NET 应用程序访问。属性包括:Document、DocumentClose、DocumentOpen、DocumentPrinted、DocumentSaved、DocumentWillPrint,以及另外 5 个。

属性

名称类型访问描述
DocumentDocument读取当前绑定用于编辑的 PDF 文档。
TextReplaceOptionsTextReplaceOptions读写由 ReplaceText(string,string) 系列使用的文本替换选项。
TextEditOptionsTextEditOptions读写Text-edit 选项转发给底层替换引擎。
TextSearchOptionsTextSearchOptions读写Text-search 选项用于有状态的文本替换变体。
ReplaceTextStrategyReplaceTextStrategy读写获取或设置替换文本策略。
DocumentOpenstring读取获取打开的文档。
DocumentClosestring读取获取文档关闭。
DocumentWillSavestring读取获取将要保存的文档。
DocumentSavedstring读取获取已保存的文档。
DocumentWillPrintstring读取获取将要打印的文档。
DocumentPrintedstring读取获取已打印的文档。

方法

签名描述
PdfContentEditor()默认构造函数 — 稍后通过 BindPdf(string) 绑定 PDF。
PdfContentEditor(document: Document)在构造时绑定到已有的 Document。
BindPdf(pdfData: byte[])绑定 PDF 文件以进行编辑。
BindPdf(inputFile: string)将 PDF 文件按路径绑定以进行编辑。
BindPdf(inputStream: Stream)将 PDF 流绑定以进行编辑。
BindPdf(srcDoc: Document)将内存中的 PDF 文档绑定以进行编辑。
Save()保存已绑定的文档。
Save(path: string)将绑定的文档保存到文件路径。
Save(stream: Stream)将绑定的文档保存到流。
Close()关闭绑定的文档。
Dispose()释放绑定的文档(等同于 Close)。
GetViewerPreference()获取当前查看器偏好标志的整数位掩码。
ChangeViewerPreference(viewerAttribution: int)更改查看器偏好设置。
GetStamps(pageNumber: int)获取页面上印章的信息。
DeleteStamp(pageNumber: int, index: int[])通过其基于0的索引删除页面上的印章。
DeleteStampById(pageNumber: int, stampId: int)通过印章ID删除印章(该ID通过 Stamp.StampId 分配)。
DeleteStampByIds(pageNumber: int, stampIds: int[])根据印章 ID 删除印章。
ReplaceText(srcString: string, destString: string)根据 ReplaceTextStrategy 替换绑定文档中的文本。
ReplaceText(srcString: string, thePage: int, destString: string)在特定页(从 1 开始)上替换文本。
ReplaceText(srcString: string, destString: string, textState: TextState)使用明确的 TextState 格式(字体/大小/颜色)替换文本。
ReplaceText(srcString: string, thePage: int, destString: string, textState: TextState)在特定页面上将文本替换为显式的 TextState。
ReplaceText(srcString: string, destString: string, fontSize: int)替换文本并覆盖替换运行的字体大小。
ReplaceText(input: byte[], searchText: string, replaceText: string)在所有页面中替换文本的所有出现。
ReplaceText(input: byte[], searchText: string, replaceText: string, options: TextSearchOptions)使用搜索选项在所有页面中替换文本的所有出现。
ReplaceTextOnPage(input: byte[], pageNumber: int, searchText: string, replaceText: string)在特定页面(从 1 开始计数)上替换文本。
CreateLocalLink(input: byte[], rect: Rectangle, pageNumber: int, destinationPage: int)创建本地链接注释,以跳转到同一文档中的页面。
CreateWebLink(input: byte[], rect: Rectangle, pageNumber: int, url: string)创建一个 URI 链接注释,以打开 URL。
CreateFreeText(input: byte[], rect: Rectangle, pageNumber: int, text: string, fontName: string?, fontSize: double)在页面上创建自由文本注释。
CreateText(input: byte[], rect: Rectangle, pageNumber: int, title: string, contents: string)在页面上创建文本(便签)批注。
DeleteAnnotations(input: byte[], pageNumber: int)删除特定页面上的所有批注。
DeleteAnnotations(input: byte[], pageNumber: int, annotationType: string)删除页面上特定子类型的批注。
ExtractText(input: byte[], pageNumber: int)从特定页面提取文本。
ExtractText(input: byte[])提取所有页面的文本。
DrawCurve(lineInfo: LineInfo, page: int, annotRect: System.Drawing.Rectangle, annotContents: string)重载,将 Rectangle 转换为 PDF 矩形形式并委托。
DrawCurve(lineInfo: LineInfo, pageNumber: int, rect: Rectangle, message: string?)在页面上绘制曲线(折线)。
CreateLocalLink(rect: System.Drawing.Rectangle, desPage: int, originalPage: int)在此 PdfContentEditor 实例上调用 CreateLocalLink(rect, desPage, originalPage)。
CreateLocalLink(rect: System.Drawing.Rectangle, desPage: int, originalPage: int, clr: System.Drawing.Color)在此 PdfContentEditor 实例上调用 CreateLocalLink(rect, desPage, originalPage, clr)。
CreateLocalLink(rect: System.Drawing.Rectangle, desPage: int, originalPage: int, clr: System.Drawing.Color, actionName: System.Enum[])在此 PdfContentEditor 实例上调用 CreateLocalLink(rect, desPage, originalPage, clr, actionName)。
CreateWebLink(rect: System.Drawing.Rectangle, url: string, originalPage: int)在此 PdfContentEditor 实例上调用 CreateWebLink(rect, url, originalPage)。
CreateWebLink(rect: System.Drawing.Rectangle, url: string, originalPage: int, clr: System.Drawing.Color)在此 PdfContentEditor 实例上调用 CreateWebLink(rect, url, originalPage, clr)。
CreateWebLink(rect: System.Drawing.Rectangle, url: string, originalPage: int, clr: System.Drawing.Color, actionName: System.Enum[])在此 PdfContentEditor 实例上调用 CreateWebLink(rect, url, originalPage, clr, actionName)。
CreateApplicationLink(rect: System.Drawing.Rectangle, application: string, page: int)在此 PdfContentEditor 实例上调用 CreateApplicationLink(rect, application, page)。
CreateApplicationLink(rect: System.Drawing.Rectangle, application: string, page: int, clr: System.Drawing.Color)在此 PdfContentEditor 实例上调用 CreateApplicationLink(rect, application, page, clr)。
CreateApplicationLink(rect: System.Drawing.Rectangle, application: string, page: int, clr: System.Drawing.Color, actionName: System.Enum[])在此 PdfContentEditor 实例上调用 CreateApplicationLink(rect, application, page, clr, actionName)。
CreatePdfDocumentLink(rect: System.Drawing.Rectangle, remotePdf: string, originalPage: int, destinationPage: int)在此 PdfContentEditor 实例上调用 CreatePdfDocumentLink(rect, remotePdf, originalPage, destinationPage)。
CreatePdfDocumentLink(rect: System.Drawing.Rectangle, remotePdf: string, originalPage: int, destinationPage: int, clr: System.Drawing.Color)在此 PdfContentEditor 实例上调用 CreatePdfDocumentLink(rect, remotePdf, originalPage, destinationPage, clr)。
CreatePdfDocumentLink(rect: System.Drawing.Rectangle, remotePdf: string, originalPage: int, destinationPage: int, clr: System.Drawing.Color, actionName: System.Enum[])在此 PdfContentEditor 实例上调用 CreatePdfDocumentLink(rect, remotePdf, originalPage, destinationPage, clr, actionName)。
CreateJavaScriptLink(code: string, rect: System.Drawing.Rectangle, originalPage: int, color: System.Drawing.Color)在此 PdfContentEditor 实例上调用 CreateJavaScriptLink(code, rect, originalPage, color)。
CreateCustomActionLink(rect: System.Drawing.Rectangle, originalPage: int, color: System.Drawing.Color, actionName: System.Enum[])在此 PdfContentEditor 实例上调用 CreateCustomActionLink(rect, originalPage, color, actionName)。
CreateFreeText(rect: System.Drawing.Rectangle, contents: string, page: int)在此 PdfContentEditor 实例上调用 CreateFreeText(rect, contents, page)。
CreateText(rect: System.Drawing.Rectangle, title: string, contents: string, open: bool, icon: string, page: int)在此 PdfContentEditor 实例上调用 CreateText(rect, title, contents, open, icon, page)。
CreateCaret(page: int, annotRect: System.Drawing.Rectangle, caretRect: System.Drawing.Rectangle, symbol: string, annotContents: string, color: System.Drawing.Color)在此 PdfContentEditor 实例上调用 CreateCaret(page, annotRect, caretRect, symbol, annotContents, color)。
CreateMarkup(rect: System.Drawing.Rectangle, contents: string, type: int, page: int, clr: System.Drawing.Color)在此 PdfContentEditor 实例上调用 CreateMarkup(rect, contents, type, page, clr)。
CreateSquareCircle(rect: System.Drawing.Rectangle, contents: string, clr: System.Drawing.Color, square: bool, page: int, borderWidth: int)在此 PdfContentEditor 实例上调用 CreateSquareCircle(rect, contents, clr, square, page, borderWidth)。
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[])在此 PdfContentEditor 实例上调用 CreateLine(rect, contents, x1, y1, x2, y2, page, border, clr, borderStyle, dashArray, LEArray)。
CreatePolygon(lineInfo: LineInfo, page: int, annotRect: System.Drawing.Rectangle, annotContents: string)在此 PdfContentEditor 实例上调用 CreatePolygon(lineInfo, page, annotRect, annotContents)。
CreatePolyLine(lineInfo: LineInfo, page: int, annotRect: System.Drawing.Rectangle, annotContents: string)在此 PdfContentEditor 实例上调用 CreatePolyLine(lineInfo, page, annotRect, annotContents)。
CreatePopup(rect: System.Drawing.Rectangle, contents: string, open: bool, page: int)在此 PdfContentEditor 实例上调用 CreatePopup(rect, contents, open, page)。
CreateRubberStamp(page: int, annotRect: System.Drawing.Rectangle, annotContents: string, color: System.Drawing.Color, appearanceFile: string)在此 PdfContentEditor 实例上调用 CreateRubberStamp(page, annotRect, annotContents, color, appearanceFile)。
CreateRubberStamp(page: int, annotRect: System.Drawing.Rectangle, annotContents: string, color: System.Drawing.Color, appearanceStream: Stream)在此 PdfContentEditor 实例上调用 CreateRubberStamp(page, annotRect, annotContents, color, appearanceStream)。
CreateRubberStamp(page: int, annotRect: System.Drawing.Rectangle, icon: string, annotContents: string, color: System.Drawing.Color)在此 PdfContentEditor 实例上调用 CreateRubberStamp(page, annotRect, icon, annotContents, color)。
CreateMovie(rect: System.Drawing.Rectangle, filePath: string, page: int)在此 PdfContentEditor 实例上调用 CreateMovie(rect, filePath, page)。
CreateSound(rect: System.Drawing.Rectangle, filePath: string, name: string, page: int, rate: string)在此 PdfContentEditor 实例上调用 CreateSound(rect, filePath, name, page, rate)。
CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, filePath: string, page: int, name: string)在此 PdfContentEditor 实例上调用 CreateFileAttachment(rect, contents, filePath, page, name)。
CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, filePath: string, page: int, name: string, opacity: double)在此 PdfContentEditor 实例上调用 CreateFileAttachment(rect, contents, filePath, page, name, opacity)。
CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, attachmentStream: Stream, attachmentName: string, page: int, name: string)在此 PdfContentEditor 实例上调用 CreateFileAttachment(rect, contents, attachmentStream, attachmentName, page, name)。
CreateFileAttachment(rect: System.Drawing.Rectangle, contents: string, attachmentStream: Stream, attachmentName: string, page: int, name: string, opacity: double)在此 PdfContentEditor 实例上调用 CreateFileAttachment(rect, contents, attachmentStream, attachmentName, page, name, opacity)。
CreateBookmarksAction(title: string, color: System.Drawing.Color, boldFlag: bool, italicFlag: bool, file: string, actionType: string, destination: string)在此 PdfContentEditor 实例上调用 CreateBookmarksAction(title, color, boldFlag, italicFlag, file, actionType, destination)。
AddDocumentAdditionalAction(eventType: string, code: string)在此 PdfContentEditor 实例上调用 AddDocumentAdditionalAction(eventType, code)。
RemoveDocumentOpenAction()在此 PdfContentEditor 实例上调用 RemoveDocumentOpenAction。
AddDocumentAttachment(fileAttachmentPath: string, description: string)在此 PdfContentEditor 实例上调用 AddDocumentAttachment(fileAttachmentPath, description)。
AddDocumentAttachment(fileAttachmentStream: Stream, fileAttachmentName: string, description: string)在此 PdfContentEditor 实例上调用 AddDocumentAttachment(fileAttachmentStream, fileAttachmentName, description)。
DeleteAttachments()在此 PdfContentEditor 实例上调用 DeleteAttachments。
ExtractLink()在此 PdfContentEditor 实例上调用 ExtractLink。
DeleteImage()在此 PdfContentEditor 实例上调用 DeleteImage。
DeleteImage(pageNumber: int, index: int[])在此 PdfContentEditor 实例上调用 DeleteImage(pageNumber, index)。
ReplaceImage(pageNumber: int, index: int, imageFile: string)在此 PdfContentEditor 实例上调用 ReplaceImage(pageNumber, index, imageFile)。
HideStampById(pageNumber: int, stampId: int)在页面上隐藏具有给定 stampId 的印章(不将其移除):印章的绘制操作仍保留,但通过空裁剪前置代码被抑制,并且使用 %StampHidden=1 标记记录状态,以便 GetStamps 报告 Visible = false,且 ShowStampById 能够恢复它。
ShowStampById(pageNumber: int, stampId: int)显示先前隐藏的印章:移除隐藏标记和空剪辑前言,使印章重新绘制。
DeleteStampById(stampId: int)删除所有页面中具有给定 stampId 的印章。
DeleteStampByIds(stampIds: int[])删除所有页面中 ID 位于 stampIds 列表中的印章。
MoveStamp(pageNumber: int, stampIndex: int, x: double, y: double)在此 PdfContentEditor 实例上调用 MoveStamp(pageNumber, stampIndex, x, y)。
MoveStampById(pageNumber: int, stampId: int, x: double, y: double)在此 PdfContentEditor 实例上调用 MoveStampById(pageNumber, stampId, x, y)。

另请参阅

 中文