功能概览
特性概述
Aspose.PDF FOSS for Java 是一个全面的 Java 库,用于 PDF 文档的创建和操作,涵盖以下能力领域:
文档结构
- 通过
Document类构造函数(无参数)创建新的 PDF 文档 - 通过
Document(filePath)或Document(stream)构造函数访问现有文档 - 通过
Document.getPages()使用PageCollection管理页面 - 每个
Page都公开getMediaBox()、getCropBox()、getRotate()和getAnnotations() - 通过
getCatalog()访问 PDF 目录,通过getTrailer()访问尾随信息 - 通过
getEmbeddedFiles()管理嵌入文件
注释
抽象类 Annotation 是所有 PDF 注释的基类。具体类型包括:WidgetAnnotation、FreeTextAnnotation、HighlightAnnotation、UnderlineAnnotation、CircleAnnotation、CaretAnnotation 等。每个注释都放置在 Page 上的 Rectangle 位置。
交互式表单
类 Form(通过 Document.getForm())管理 AcroForm 字段。字段类型包括 ButtonField、CheckboxField、RadioButtonField、TextBoxField、ComboBoxField 和 ListBoxField。FormEditor 类提供用于批量表单编辑的便捷方法。
页面操作
PdfFileEditor 提供 concatenate()、extract()、splitToPages()、insert() 和 delete() 用于页面级文档操作。ContentsResizeParameters 和 ContentsResizeValue 控制页面边界内的内容缩放。
PDF/A 合规
ActionRules 验证 PDF/A 行动符合性; ActionFixes 通过 removeCatalogAA()、removePageAA() 和 removeWidgetAA() 提供补救。AnnotationRules 和 AnnotationFixes 处理注释级别的合规性。
Security
AESCipher 提供 AES-CBC 加密,使用 encrypt(key, data)、decrypt(key, data) 和确定性 IV 变体。PdfFileSecurity 管理文档级别的密码保护和访问权限。
页面渲染
BmpDevice 将 PDF 页面渲染为 BMP 图像文件,以生成缩略图和预览。PdfPageRenderer 提供编程式页面渲染。
Facades
该 org.aspose.pdf.facades 包提供面向任务的类,包括 PdfAnnotationEditor、PdfBookmarkEditor、PdfContentEditor、PdfExtractor、PdfFileSecurity、PdfFileStamp 和 PdfPageEditor。