Home >Java >javaTutorial >How to remove comments in PDF using Java

How to remove comments in PDF using Java

WBOY
WBOYforward
2023-04-28 12:04:061362browse

Process

1. Use the Document class to load the PDF document.

2. Use Document.getPages().get_Item(int).getAnnotations().delete() to delete all annotations.

3. Use Document.save to save the updated PDF.

Example

// 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");

The above is the detailed content of How to remove comments in PDF using Java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete