GroupDocs.Redaction for Java 23.7 Release Notes

Major Features

There are the following improvements in this release:

  • Redaction failed for a random pdf file
  • Implement settings to set page and area scope for redactions

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
REDACTIONJAVA-173Redaction failed for a random pdf fileBug
REDACTIONJAVA-175Implement settings to set page and area scope for redactionsImprovement

Public API and Backward Incompatible Changes

Redaction failed for a random pdf file

This bugfix resolves a PDF documents issue with a big and complex regular expression.

Implement settings to set page and area scope for redactions

This improvement allows users to specify page area and page range scope for textual redactions in a PDF file.

Public API changes

Class RedactionFilter, representing base abstract class for redaction filters, has been added to com.groupDocs.redaction.redactions package.
Class PageRangeFilter, setting redaction scope to a set of pagess, has been added to com.groupDocs.redaction.redactions package.
Class PageAreaFilter, setting redaction scope to an area of any page, has been added to com.groupDocs.redaction.redactions package.
Methods getFilters and setFilters, getting and setting an array of RedactionFilter instances, have been added to com.groupDocs.redaction.redactions.ReplacementOptions class.

Usage

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");
        try 
        {
            // 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)
            {
                redactor.save();
            }                            
        }
        finally { redactor.close(); }