Use PDF redaction filters

You can combine PageRangeFilter and PageAreaFilter filters in one set in order to set the scope of redaction to an area on a specific page. You have to set an array of instances to Filters property of the ReplacementOptions.

The following example demonstrates how to apply redaction to the bottom half of the last page in a PDF document.

        final Redactor redactor = new Redactor("Sample.pdf");
            // Get the actual size information for the last page:
            IDocumentInfo info = redactor.getDocumentInfo();
            PageInfo lastPage = info.getPages().get(info.getPageCount() - 1);
            ReplacementOptions options = new ReplacementOptions("[secret]");
            options.setFilters(new RedactionFilter[] {
                new PageRangeFilter(PageSeekOrigin.End, 0, 1),
                new PageAreaFilter(new java.awt.Point(0, lastPage.getHeight()/2),
                    new java.awt.Dimension(lastPage.getWidth(), lastPage.getHeight()/2))
            RedactorChangeLog result = redactor.apply(new ExactPhraseRedaction("bibliography", false, options));
            if (result.getStatus() != RedactionStatus.Failed)
        finally { redactor.close(); }