首页 > 文章列表 > Java怎么在PDF中删除注释

Java怎么在PDF中删除注释

java PDF
243 2023-04-26

流程

1、使用Document类加载PDF文档。

2、用Document.getPages().get_Item(int).getAnnotations().delete()删除所有注释。

3、用Document.save保存更新的PDF。

实例

// Open source PDF document
Document pdfDocument = new Document("input.pdf");
 
// Delete all annotation
pdfDocument.getPages().get_Item(1).getAnnotations().delete();
 
// Save the update document
pdfDocument.save("output.pdf");