PdfPageEditor
概述
PdfPageEditor 是 Aspose.PDF FOSS 中用于 .NET 的类。继承自:System.IDisposable。
页面级编辑的外观层:旋转、缩放、边距调整和页面框操作(CropBox、TrimBox、BleedBox、ArtBox)。
此类提供了 30 个用于在 .NET 程序中处理 PdfPageEditor 对象的方法。可用的方法包括:ApplyChanges、BindPdf、Close、Dispose、GetArtBox、GetBleedBox、GetCropBox、GetPageBoxSize、GetPageRotation、GetPageSize、GetPages、GetTrimBox,以及另外 12 个方法。安装 Aspose.PDF FOSS for .NET 包后,所有公共成员对任何 .NET 应用程序均可访问。属性:Alignment、BLINDH、BLINDV、BTWIPE、DGLITTER、DISSOLVE,以及另外 23 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
Document | Document | 读取 | 保存已绑定的文档并返回 PDF 字节。 |
PageSize | PageSize? | 读写 | 页面尺寸用于后续操作(无操作存储)。 |
HorizontalAlignment | HorizontalAlignment | 读写 | 后续操作的水平对齐(no-op 已存储)。 |
VerticalAlignmentType | VerticalAlignment | 读写 | 后续操作的垂直对齐(no-op 已存储)。 |
Zoom | float | 读写 | 后续操作的缩放因子(no-op 已存储)。 |
Rotation | int | 读写 | 获取或设置页面旋转角度(0、90、180、270)。 |
DisplayDuration | int | 读写 | 获取或设置绑定文档中页面的显示时长(秒)。 |
Alignment | AlignmentType | 读写 | 当设置 PageSize 时,用于在调整大小后的媒体框内定位页面内容的水平对齐方式。 |
VerticalAlignment | VerticalAlignmentType | 读写 | 当 PageSize 被设置时,用于在调整大小后的媒体框内定位页面内容的垂直对齐方式。 |
PageRotations | Dictionary<int, int> | 读写 | 按页的旋转映射表,以基于 1 的页码为键,值为以度为单位的旋转角度(0/90/180/270)。 |
ProcessPages | int[]? | 读写 | 后续有状态操作适用的基于 1 的页码。 |
TransitionType | int | 读写 | 过渡样式代码(使用此类中的静态常量)。 |
TransitionDuration | int | 读写 | 以秒为单位的过渡效果持续时间(PDF /Trans /D)。 |
SPLITVOUT | int | 读取 | 获取 splitvout。 |
SPLITHOUT | int | 读取 | 获取 splithout。 |
SPLITVIN | int | 读取 | 获取 splitvin。 |
SPLITHIN | int | 读取 | 获取 splithin。 |
BLINDV | int | 读取 | 获取 blindv。 |
BLINDH | int | 读取 | 获取 blindh。 |
INBOX | int | 读取 | 获取收件箱。 |
OUTBOX | int | 读取 | 获取发件箱。 |
LRWIPE | int | 读取 | 获取 lrwipe。 |
RLWIPE | int | 读取 | 获取 rlwipe。 |
BTWIPE | int | 读取 | 获取 btwipe。 |
TBWIPE | int | 读取 | 获取 tbwipe。 |
DISSOLVE | int | 读取 | 获取溶解。 |
LRGLITTER | int | 读取 | 获取 lrglitter。 |
TBGLITTER | int | 读取 | 获取 tbglitter。 |
DGLITTER | int | 读取 | 获取 dglitter。 |
方法
| 签名 | 描述 |
|---|---|
PdfPageEditor() | 在此 PdfPageEditor 实例上调用 PdfPageEditor。 |
PdfPageEditor(document: Document) | 在构造时直接绑定。 |
BindPdf(path: string) | 通过路径绑定 PDF 文件进行编辑。 |
BindPdf(pdfData: byte[]) | 绑定 PDF 数据进行编辑。 |
BindPdf(srcDoc: Document) | 绑定 PDF 流进行编辑。 |
BindPdf(stream: Stream) | 在此 PdfPageEditor 实例上调用 BindPdf(stream)。 |
Save(outputFile: string) | 将绑定的文档保存到文件。 |
Save(outputStream: Stream) | 将绑定的文档保存到流中。 |
ApplyChanges() | 对绑定的文档应用排队的更改——当设置 PageSize 时会调整目标页面的大小。 |
Save() | 在此 PdfPageEditor 实例上调用 Save。 |
Close() | 释放已绑定的文档。 |
Dispose() | IDisposable 实现;委托给 Close。 |
GetPages() | 已绑定文档的页数。 |
GetPageRotation(page: int) | 以1为基准的页面旋转角度(0/90/180/270)。 |
GetPageSize(page: int) | 以1为基准的页面尺寸,来源于页面 MediaBox。 |
GetPageBoxSize(page: int, pageBoxName: string) | 将命名的页面框矩形作为 Rectangle 返回。 |
MovePosition(moveX: float, moveY: float) | 记录一个平移偏移量(以点为单位),用于后续操作。 |
RotatePages(input: byte[], rotation: int, pageNumbers) | 旋转指定页面。 |
SetRotation(input: byte[], rotation: int, pageNumbers) | 将指定页面的旋转设置为绝对值。 |
ResizePages(input: byte[], newMediaBox: Rectangle, pageNumbers) | 将指定页面的尺寸调整为新的媒体框。 |
SetCropBox(input: byte[], pageNumber: int, rect: Rectangle) | 在特定页面上设置 CropBox(可见区域)。 |
SetTrimBox(input: byte[], pageNumber: int, rect: Rectangle) | 在特定页面上设置 TrimBox(裁剪后预期的完成页面尺寸)。 |
SetBleedBox(input: byte[], pageNumber: int, rect: Rectangle) | 在特定页面上设置 BleedBox(打印时应剪切内容的区域)。 |
SetArtBox(input: byte[], pageNumber: int, rect: Rectangle) | 在特定页面上设置 ArtBox(有意义的内容区域)。 |
SetMargins(input: byte[], pageNumber: int, left: double, bottom: double, right: double, top: double) | 通过相对于 MediaBox 修改 CropBox 来调整页边距。 |
GetCropBox(input: byte[], pageNumber: int) | 获取特定页面的 CropBox。 |
GetTrimBox(input: byte[], pageNumber: int) | 获取特定页面的TrimBox。 |
GetBleedBox(input: byte[], pageNumber: int) | 获取特定页面的 BleedBox。 |
GetArtBox(input: byte[], pageNumber: int) | 获取特定页面的 ArtBox。 |
ScalePage(input: byte[], pageNumber: int, scaleX: double, scaleY: double) | 通过调整 MediaBox 尺寸来缩放页面内容。 |