Here are the key reasons to use the new updated API provided by GroupDocs.Redaction for .NET since version 19.9:
Redactor class introduced as a single entry point to manage the document redaction process (instead of Documentclass from previous versions).
Methods RedactWith() of the Document class were replaced with similar Apply() methods in Redactor class.
Method Document.Save(Stream, SaveOptions) was replaced with Redactor.Save(Stream, RasterizationOptions).
Constructor LoadOptions(DocumentFormatConfiguration) was removed.
Exception and option classes were put in separate namespaces.
RedactionSummary was renamed into RedactorChangeLog, RedactionLogEntry into RedactorLogEntry, MetadataFilter into MetadataFilters.
Obsolete members were removed from Public API.
Added a number of new exception classes and base exception class for GroupDocs.Redaction exceptions.
How To Migrate?
The following example demonstrates how to redact Microsoft Office Word document and dumping statuses of applied redactions using old and new API:
Old coding style
using(Documentdoc=Redactor.Load(@"Documents/Doc/sample.docx")){// Here we can use document instance to perform redactionsRedactionSummarysummary=doc.RedactWith(newExactPhraseRedaction("John Doe",newReplacementOptions("[personal]")));foreach(RedactionLogEntryentryinsummary.RedactionLog){Console.WriteLine(entry.Status.ToString());}doc.Save();}
New coding style
using(Redactorredactor=newRedactor(@"Documents/Doc/sample.docx")){// Here we can use document instance to perform redactionsRedactorChangeLogresult=redactor.Apply(newExactPhraseRedaction("John Doe",newReplacementOptions("[personal]")));foreach(RedactorLogEntryentryinresult.RedactionLog){Console.WriteLine(entry.Status.ToString());}redactor.Save();}
For more code examples and specific use cases please refer to our Developer Guide documentation or GitHub samples and showcases.
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.