Redact Private Information via Java API

Exclude or hide personal information & metadata from documents, worksheets, presentations, PDF and raster image files using Java redaction API.


Download Free Trial

GroupDocs.Redaction for Java API lets developers remove sensitive data from popular file formats like Microsoft Word, Excel, PowerPoint, PDF and images so it can be used and distributed, but still protect confidential information too. The redaction library offers a single format-independent interface to redact any type of classified information including social security numbers, medical information, financial, proprietary, legal or even trade details through text, metadata and annotation redaction types. It allows you to save the document in its original format and create a sanitized PDF document with raster images of original pages.

GroupDocs.Redaction for Java Features

Ensure Privacy by Redacting your Classified Data

GroupDocs.Redaction for Java library empowers developers to redact text and images from supported documents by employing a variety of redaction types. To use our Redaction API is simple and straight forward.

The following code example uses a tabular document such as Microsoft Excel spreadsheet where the scope of redaction can be limited to a specific worksheet and/or column. It uses filters to redact the second column with emails on a worksheet “Customers”, leaving all other emails untouched in the document.

final Redactor redactor  = new Redactor("sample.xlsx");
try
{
    CellFilter filter = new CellFilter();
    filter.setColumnIndex(1);
    filter.setWorkSheetName("Customers");
    Pattern expression = Pattern.compile("^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
    RedactorChangeLog result = redactor.apply(new CellColumnRedaction(filter, expression, new ReplacementOptions("[customer email]")));
    if (result.getStatus() != RedactionStatus.Failed)
    {
        SaveOptions so = new SaveOptions();
        so.setAddSuffix(true);
        so.setRasterizeToPDF(false);
        redactor.save(so);
    };
}
finally { redactor.close(); }

Support and Learning Resources

GroupDocs.Redaction offers document viewing APIs for other popular development environments

Back to top
 English