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

How to remove comments in PDF using Java

WBOY
Release: 2023-04-28 12:04:06
forward
1346 people have browsed it

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");
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template