Remove annotations

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:

Remove annotations

On this page

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.