With GroupDocs.Redaction API you can apply annotation redactions for documents of different formats like PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX and others. See full list at supported document formats article.
GroupDocs.Redactions provides a flexible API that allows to remove sensitive data from annotation text, or completely remove annotations by a regular expression.
Remove annotations (comments etc)
You can use GroupDocs.Redaction to remove all or specific comments and other annotations from the document. For example, we can remove all comments from the document, containing texts like “use”, “show” or “describe” in its body:
Python
importgroupdocs.redactionasgrimportgroupdocs.redaction.redactionsasgrrdefrun():# Specify the redaction optionsa_red=grr.DeleteAnnotationRedaction("(?im:(use|show|describe))")# Load the document to be redactedwithgr.Redactor("source.pdf")asredactor:# Apply the redactionresult=redactor.apply(a_red)# Save the redacted documentredactor.save()
You can use constructor without arguments to remove all annotations within the document.
Redact annotations
Instead of removing all or specific annotations, you can remove sensitive data from the annotation text. For instance, we can remove all mentions of “John” in the given document, e.g.:
Python
importgroupdocs.redactionasgrimportgroupdocs.redaction.redactionsasgrrdefrun():# Specify the redaction optionsa_red=grr.AnnotationRedaction("(?im:john)","[redacted]")# Load the document to be redactedwithgr.Redactor("source.pdf")asredactor:# Apply the redactionresult=redactor.apply(a_red)# Save the redacted documentredactor.save()
More resources
Advanced usage topics
To learn more about document redaction features, please refer to the advanced usage section.
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples:
Along with full featured .NET library we provide simple, but powerful free Apps.
You are welcome to perform redactions for various document formats like PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Redaction App.
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.