PdfFileInfo
概述
PdfFileInfo 是 Aspose.PDF FOSS 中用于 .NET 的类。继承自:IDisposable。
用于访问 PDF 文档元数据和属性的外观。
此类为在 .NET 程序中处理 PdfFileInfo 对象提供了 34 个方法。可用的方法包括:BindPdf、ClearInfo、Close、Dispose、GetDocumentInfo、GetDocumentPrivilege、GetMetaInfo、GetPageHeight、GetPageRotation、GetPageWidth、GetPageXOffset、GetPageYOffset,以及另外 8 个方法。安装 Aspose.PDF FOSS for .NET 包后,所有公共成员对任何 .NET 应用程序均可访问。属性包括:Author、CreationDate、CreationDateValue、Creator、Document、HasCollection,以及另外 26 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
Document | Document? | 读取 | 已绑定的文档。 |
InputFile | string? | 读写 | 源 PDF 的路径。 |
HasOpenPassword | bool | 读取 | PDF 是否需要用户/打开密码才能打开。 |
HasEditPassword | bool | 读取 | PDF 是否具有所有者/编辑密码(即. |
PasswordType | PasswordType | 读取 | 哪种密码(如果有的话)对已绑定的 PDF 进行了身份验证。 |
Title | string? | 读写 | 文档标题。 |
Author | string? | 读写 | 文档作者。 |
Subject | string? | 读写 | 文档主题。 |
Keywords | string? | 读写 | 文档关键字。 |
Creator | string? | 读写 | 创建者应用程序。 |
Producer | string? | 读取 | 创建 PDF 的生成程序。 |
Header | Dictionary<string, string> | 读写 | 来自底层 /Info 字典的自定义元数据条目,按名称键入。 |
CreationDate | string | 读写 | PDF 原生格式的创建日期 (D:YYYYMMDDHHmmSSOHH’mm’),若不存在则为空。 |
CreationDateValue | DateTime | 读写 | 原始 DateTime 视图(仅限 FOSS 的便利)。 |
ModDate | string | 读写 | PDF 本机格式的修改日期 (D:YYYYMMDDHHmmSSOHH’mm’),如果不存在则为空。 |
ModDateValue | DateTime | 读写 | 原始 DateTime 视图(仅限 FOSS 的便利)。 |
NumberOfPages | int | 读取 | 页数。 |
PdfVersion | string? | 读取 | PDF 版本字符串(例如 “1.4”, “1.7”)。 |
IsEncrypted | bool | 读取 | 文档是否已加密。 |
HasForm | bool | 读取 | 文档是否包含表单。 |
HasOutlines | bool | 读取 | 文档是否包含书签。 |
HasMetadata | bool | 读取 | 文档是否包含 XMP 元数据。 |
HasEmbeddedFiles | bool | 读取 | 文档是否包含嵌入的文件。 |
HasPageLabels | bool | 读取 | 文档是否具有页面标签。 |
HasLayers | bool | 读取 | 文档是否具有图层(可选内容)。 |
HasCollection | bool | 读取 | 文档是否为 PDF 组合文档(在目录中具有 /Collection 条目)。 |
IsTagged | bool | 读取 | 文档是否已标记。 |
PageLayout | string? | 读取 | 页面布局模式(例如,“SinglePage”,“TwoColumnLeft”)。 |
PageMode | string? | 读取 | 页面模式(例如,“UseOutlines”,“FullScreen”)。 |
IsPdfFile | bool | 读取 | 绑定文档是否为有效的 PDF 文件(实例属性)。 |
InputStream | Stream? | 读写 | Source-PDF 流。 |
UseStrictValidation | bool | 读写 | 当为 true 时,解析器会应用严格的 PDF 验证规则。 |
方法
| 签名 | 描述 |
|---|---|
PdfFileInfo() | 创建一个空的 PdfFileInfo 实例。 |
PdfFileInfo(document: Document) | 创建一个包装现有 Document 的 PdfFileInfo 实例。 |
PdfFileInfo(input: byte[]) | 从 PDF 字节创建一个 PdfFileInfo 实例。 |
PdfFileInfo(input: byte[], password: string) | 使用密码从 PDF 字节创建一个 PdfFileInfo 实例。 |
PdfFileInfo(inputFile: string) | 从文件路径创建一个 PdfFileInfo 实例。 |
PdfFileInfo(inputFile: string, password: string) | 使用密码从文件路径创建一个 PdfFileInfo 实例。 |
PdfFileInfo(inputStream: Stream) | 从流创建一个 PdfFileInfo 实例。 |
PdfFileInfo(inputStream: Stream, password: string) | 使用密码从流打开。 |
PdfFileInfo(inputStream: Stream, password: string, customSecurityHandler: Aspose.Pdf.Security.ICustomSecurityHandler) | 使用密码从流中打开,并通过自定义安全处理程序解密。 |
PdfFileInfo(inputFile: string, password: string, customSecurityHandler: Aspose.Pdf.Security.ICustomSecurityHandler) | 使用密码从文件路径打开,并通过自定义安全处理程序解密。 |
SaveNewInfo() | 将修改后的信息保存为一个新的 PDF 文件。 |
SaveNewInfoWithXmp() | 将修改后的信息保存为一个新的 PDF 文件,并将 Info 字典条目同步到 XMP 元数据。 |
SaveNewInfoWithXmp(outputFileName: string) | 将修改后的信息保存到文件,并将 Info 字典条目同步到 XMP 元数据。 |
SetMetaInfo(name: string, value: string) | 在文档信息字典中设置自定义元数据属性。 |
GetMetaInfo(name: string) | 从文档信息字典中获取自定义元数据属性。 |
GetPdfVersion() | 与 PdfFileInfo.GetPdfVersion() 公共接口相匹配的 PdfVersion 方法形式别名。 |
GetPageWidth(pageNum: int) | 获取特定页面的宽度(单位为点),页面编号从 1 开始。 |
GetPageHeight(pageNum: int) | 获取特定页面的高度(单位为点),页面编号从 1 开始。 |
GetPageRotation(pageNum: int) | 获取特定页面的旋转角度(0、90、180、270)。 |
GetPageXOffset(pageNum: int) | 页面在媒体边界内的裁剪原点的 X 坐标(CropBox 左侧内边距)。 |
GetPageYOffset(pageNum: int) | 页面在媒体边界内的裁剪原点的 Y 坐标(CropBox 底部内边距)。 |
GetDocumentInfo() | 获取所有文档元数据作为字典。 |
IsValidPdfBytes(data: byte[]) | 检查给定的字节是否表示有效的 PDF 文件。 |
IsValidPdfStream(stream: Stream) | 检查给定的流是否表示有效的 PDF 文件。 |
GetDocumentPrivilege() | 获取文档权限(特权)。 |
BindPdf(srcDoc: Document) | 将此外观绑定到现有的 Document 实例。 |
ClearInfo() | 清除已绑定文档的标准 /Info 字典条目(Title、Author、Subject、Keywords、Creator、Producer、Trapped、CreationDate、ModDate)。 |
BindPdf(path: string) | 将此外观绑定到给定路径的 PDF 文件。 |
Save(destStream: Stream) | 将绑定的文档保存到流中。 |
Save(destFile: string) | 将绑定的文档保存到文件路径。 |
Close() | 关闭并释放绑定的文档。 |
SaveNewInfo(outputStream: Stream) | 将修改后的 Info 字典保存到流中。 |
SaveNewInfo(outputFile: string) | 将修改后的 Info 字典保存到文件中。 |
Dispose() | 对该 PdfFileInfo 实例调用 Dispose。 |