Apache PDFBox 3最新入门指南(3.0.0-alpha2 released版本)

PDFBOX的8个作用:

1、提取文字:
提取pdf中的Unicode 文本
2、分割和合并PDF
分割单个PDF为多个PDF或者是合并多个PDF为一个DPF
3、填充PDF里面的表单
提取PDF表单内容或填充PDF表单
4、印前检查
根据PDF/A-1b标准,校验PDF文件。
5、打印PDF
通过JAVA的API打印PDF文件。
6、图片转换
把PDF文件转成PNG或JPEG格式的图片
7、创建PDF文件
从零开始创建PDF文件,往里面嵌入文字和图片
8、签名
对PDF文件签名
 


背景:

基于对Apache PDFBox的热爱,我想根据Apache PDFBox 3研究一下是如何使用,及改进了哪些内容。


相较于2.0版本的差异:

(1)3.0版本保留了PDPageContentStream的一些废弃方法(appendRawCommands)。

(2)3.0版本需要把PDDocument.load 改成Loader.loadPDF 方法。

(3)3.0版本增加了非压缩模式的保存PDF。通过PDDocument.save 方法的 CompressParameters.NO_COMPRESSION参数完成。

例如从原来的

doc.save(pdfPath);

变成

doc.save(pdfPath, CompressParameters.NO_COMPRESSION);

(4)3.0版本优化了操作PDF文件时的内容消耗。

(5)3.0版本相较于2.0版本删除了14种字头。

(6)修改PDDocumentCatalog.getAcroForm()获取AcroForms对象。例如使用命令:

PDDocumentCatalog.getAcroForm(null)

(7)重写了PDFBox应用程序的命令行接口。


参考链接:

Apache PDFBox | PDFBox 3.0 Migration GuideThe Apache PDFBox™ library is an open source Java tool for working with PDF documents. This project allows creation of new PDF documents, manipulation of existing documents and the ability to extract content from documents. Apache PDFBox also includes several command-line utilities. Apache PDFBox is published under the Apache License v2.0.https://pdfbox.apache.org/3.0/migration.html

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值