Here are the key reasons to use the new updated API provided by GroupDocs.Redaction for Java since version 19.6:
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(OutputStream, SaveOptions) was replaced with Redactor.save(OutputStream, RasterizationOptions).
Constructor LoadOptions(DocumentFormatConfiguration) was removed.
RedactionSummary was renamed into RedactorChangeLog, RedactionLogRecord into RedactorLogRecord, 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
// Load the file
Documentdoc=Redactor.load("Documents/Doc/sample.docx");//Perform redaction using exact phrase
RedactionSummarysummary=doc.redactWith(newExactPhraseRedaction("John Doe",newReplacementOptions("[Personal]")));for(RedactionLogEntryentry:summary.getRedactionLog()){System.out.println(entry.getStatus());}//Save the resultant document
doc.save();// Close the Document
doc.close();
New coding style
// Load the file
Redactorredactor=newRedactor("Documents/Doc/sample.docx");//Perform redaction using exact phrase
RedactorChangeLogsummary=redactor.apply(newExactPhraseRedaction("John Doe",newReplacementOptions("[Personal]")));for(RedactorLogEntryentry:summary.getRedactionLog()){System.out.println(entry.getResult().getStatus());}//Save the resultant document
redactor.save();// Close the Redactor
redactor.close();
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.