In some cases, you might need to pre-rasterize the document before opening it and applying redactions.
For instance, you might need to use an ImageAreaRedaction for a whole page of a document with searchable text and images. In order to do that, you will need to pass the Boolean flag to the LoadOptions class constructor.
The following example demonstrates how to pre-rasterize a Microsoft Word document:
LoadOptionsloadOptions=newLoadOptions(/*preRasterize*/true);finalRedactorredactor=newRedactor("sample.docx",loadOptions);try{// Make changes to the file as a rasterized PDF, e.g. uisng ImageAreaRedaction:
java.awt.PointsamplePoint=newjava.awt.Point(516,311);java.awt.DimensionsampleSize=newjava.awt.Dimension(170,35);RedactorChangeLogresult=redactor.apply(newImageAreaRedaction(samplePoint,newRegionReplacementOptions(java.awt.Color.RED,sampleSize)));if(result.getStatus()!=RedactionStatus.Failed){redactor.save();};}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.