You might need to save a document to any custom file at any location on the local disc or a even a Stream.
The following example demonstrates how to save a document to any location.
finalRedactorredactor=newRedactor("sample.docx");try{// Here we can use document instance to perform redactions
RedactorChangeLogresult=redactor.apply(newExactPhraseRedaction("John Doe",newReplacementOptions(java.awt.Color.RED)));if(result.getStatus()!=RedactionStatus.Failed){// Save the document to a stream and convert its pages to images
finalFileOutputStreamfileStream=newFileOutputStream("redacted-sample.pdf");try{RasterizationOptionsoptions=newRasterizationOptions();options.setEnabled(true);redactor.save(fileStream,options);}finally{fileStream.close();}}}finally{redactor.close();}
sample.docx is the sample file used in this example. Click here to download it.