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 remove_annotations property to True.
The following code snippet shows how to remove annotations from the file:
from groupdocs.viewer import Viewer
from groupdocs.viewer.options import PdfViewOptions, PdfOptimizationOptions
def remove_annotations():
# Load document
with Viewer("sample.docx") as viewer:
viewOptions = PdfViewOptions("remove_annotations/without_annotations.pdf")
viewOptions.pdf_optimization_options = PdfOptimizationOptions()
viewOptions.pdf_optimization_options.remove_annotations = True
viewer.view(viewOptions)
if __name__ == "__main__":
remove_annotations()
sample.docx is the sample file used in this example. Click here to download it.
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.