Home >Java >javaTutorial >How to remove comments in PDF using Java
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!