GroupDocs.Redaction for Java 20.11 Release Notes

Major Features

There are the following improvements in this release:

  • Ability to save Redaction Policy to an XML file
  • Built-in support for plain text format (previously was an example)
  • Support for HTML documents and Markdown files
  • Improve PDF preview generation

Full List of Issues Covering all Changes in this Release

REDACTIONJAVA-107Saving RedactionPolicy.xml fileImprovement
REDACTIONJAVA-108Add support for HTML documents and Markdown filesImprovement
REDACTIONJAVA-109Add built-in support for plain text formatImprovement
REDACTIONJAVA-110Improve PDF preview generationImprovement

Public API and Backward Incompatible Changes

Saving RedactionPolicy.xml file in Java

This feature provides functionality to save a redaction policy created in code as an XML file for further use.

Add support for HTML documents and Markdown files

This feature provides support for HTML documents and Markdown files.

Add built-in support for plain text format

This feature provides built-in support for plain text format. Previously, user had to take the class from public examples and configure it as a custom format handler.

Improve PDF preview generation

This feature contains improvements for PDF preview rendering and embedded images redactions.

Public API changes

Constructor RedactionPolicy(Redaction[]) taking an array of redactions has been added.
Methods and have been added.
Class Redactor now implements interface IPreviewable.


The following example demonstrates how to save a RedactionPolicy to an XML file.

RedactionPolicy policy = new RedactionPolicy(new Redaction[] {
    new ExactPhraseRedaction("Redaction", new ReplacementOptions("[Product]")),
    new RegexRedaction("\\d{2}\\s*\\d{2}[^\\d]*\\d{6}", new ReplacementOptions(java.awt.Color.BLUE)),
    new DeleteAnnotationRedaction(),
    new EraseMetadataRedaction(MetadataFilters.All)

The following example demonstrates how to get a single page preview of the document.

// Test file
final String testFile = "D:\\sample.pdf";
// Take preview of the first page
int testPageNumber = 1;
// Preview file name
final String previewFileName = String.format("%s_page%d.png", testFile, testPageNumber);
// Load the document to generate preview
final Redactor redactor = new Redactor(testFile);
    PreviewOptions options = new PreviewOptions(new ICreatePageStream() { 
        public createPageStream(int pageNumber) { 
            try {
                return new; 
            } catch ( ex) {
                System.out.printf("Failed to create preview file %s: \"%s\"\n\n", previewFileName, ex.toString());
                return null;
    options.setPageNumbers(new int[] { testPageNumber });
    System.out.printf("\nPreview for page: %d  was saved to \"%s\"\n\n", testPageNumber, previewFileName);
finally { redactor.close(); }