The following example demonstrates how to save the redacted document, replacing an original file:
// Make a copy of sample file
Files.copy(newFile("Sample.docx").toPath(),newFile("OverwrittenSample.docx").toPath(),StandardCopyOption.REPLACE_EXISTING);// Apply redaction
finalRedactorredactor=newRedactor("OverwrittenSample.docx");try{RedactorChangeLogresult=redactor.apply(newExactPhraseRedaction("John Doe",newReplacementOptions(java.awt.Color.RED)));if(result.getStatus()!=RedactionStatus.Failed){SaveOptionsoptions=newSaveOptions();options.setAddSuffix(false);options.setRasterizeToPDF(false);// Save the document in original format overwriting original file
redactor.save(options);}}finally{redactor.close();}
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.