Remove annotations
Leave feedback
On this page
If the output PDF file contains annotations, you can remove them to reduce the file size.
To remove annotations, set the setRemoveAnnotations to true
.
The following code snippet shows how to remove annotations from the file:
try (Viewer viewer = new Viewer("sample.docx")) {
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.setPdfOptimizationOptions(new PdfOptimizationOptions());
viewOptions.getPdfOptimizationOptions().setRemoveAnnotations(true);
viewer.view(viewOptions);
}
The following image demonstrates the result:
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.