GroupDocs.Redaction for Java 23.9 Release Notes
Major Features
There are the following improvements in this release:
- Redaction in Arabic document
- Redact large area of PDF document based on selection
Full List of Issues Covering all Changes in this Release
Key | Summary | Category |
---|---|---|
REDACTIONJAVA-168 | Redaction in Arabic document | Bug |
REDACTIONJAVA-173 | Redaction failed for a random pdf file | Bug |
REDACTIONJAVA-177 | Redact large area of PDF document based on selection | Improvement |
Public API and Backward Incompatible Changes
Redaction in Arabic document
This bugfix allows users to specify right-to-left text direction for ExactPhraseRedaction.
Redaction failed for a random pdf file
This bugfix resolves an issue with some complex regular expressions in RegexRedaction.
Redact large area of PDF document based on selection
This bugfix resolves a PDF documents issue when you need to redact text, images and annotations for a specific page range or page area.
Public API changes
Interface IFixedFormatDocument, defining methods, required for fixed structure formats, such as PDF, has been added to com.grouprocs.redaction.integration package.
Class PageAreaRedaction, that affects text, images and annotations in an area of the page, has been added to com.grouprocs.redaction.redactions package.
Methods isRightToLeft() and setRightToLeft(boolean), getting and setting a boolean value to indicate right-to-left languages, have been added to com.grouprocs.redaction.redactions.ExactPhraseRedaction class.
Usage
The following example demonstrates how to apply ExactPhraseRedaction to an Arabic PDF document.
final Redactor redactor = new Redactor("Arabic.pdf");
try
{
ExactPhraseRedaction red = new ExactPhraseRedaction("أﺑﺠﺪ", new ReplacementOptions("[test]"));
red.setRightToLeft(true);
redactor.apply(red);
redactor.save();
}
finally { redactor.close(); }
The following example demonstrates how to redact the whole paragraph in a PDF document.
final Redactor redactor = new Redactor("LoremIpsum.pdf");
try
{
redactor.apply(new RegexRedaction("(Lorem(\n|.)+?urna)", new ReplacementOptions("[test]")));
SaveOptions saveOptions = new SaveOptions();
saveOptions.setAddSuffix(true);
saveOptions.setRasterizeToPDF(false);
redactor.save(saveOptions);
}
finally { redactor.close(); }
The following example demonstrates how to apply PageAreaRedaction to the right half of the last page in a PDF document.
final Redactor redactor = new Redactor("Sample.pdf");
try
{
java.util.regex.Pattern rx = java.util.regex.Pattern.compile("urna");
ReplacementOptions optionsText = new ReplacementOptions("[redarea]");
optionsText.setFilters(new RedactionFilter[] {
new PageRangeFilter(PageSeekOrigin.End, 0, 1), // last page
new PageAreaFilter(new java.awt.Point(300, 0), new java.awt.Dimension(300, 840)) // right half of the page
});
RegionReplacementOptions optionsImg = new RegionReplacementOptions(java.awt.Color.RED, new java.awt.Dimension(100, 100));
RedactorChangeLog result = redactor.apply(new PageAreaRedaction(rx, optionsText, optionsImg));
if (result.getStatus() != RedactionStatus.Failed)
{
redactor.save();
}
}
finally { redactor.close(); }