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:

        LoadOptions loadOptions = new LoadOptions(/*preRasterize*/ true);
        final Redactor redactor = new Redactor("sample.docx", loadOptions);
            // Make changes to the file as a rasterized PDF, e.g. uisng ImageAreaRedaction:
            java.awt.Point samplePoint = new java.awt.Point(516, 311);
            java.awt.Dimension sampleSize = new java.awt.Dimension(170, 35);
            RedactorChangeLog result = redactor.apply(new ImageAreaRedaction(samplePoint,
                new RegionReplacementOptions(java.awt.Color.RED, sampleSize)));
            if (result.getStatus() != RedactionStatus.Failed)
        finally { redactor.close(); }