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 RemoveAnnotations property to true.

The following code snippet shows how to remove annotations from the file:

using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
using GroupDocs.Viewer.Domain.Documents.PostProcessing.Pdf.Optimization;
// ...

using (var viewer = new Viewer("sample.docx"))
{
    PdfViewOptions viewOptions = new PdfViewOptions();
    viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions()
    {
        RemoveAnnotations = true
    };
     
    viewer.View(viewOptions);
}

The following image demonstrates the result:

Remove annotations

On this page