Top Features of GroupDocs.Redaction for Java

Mask Text in PDF Documents Using Overlays in Java

Take full control of PDF file content with Java. Use redaction to shield financial, legal, or personal details.

Secure Confidential Info in Pdf Files

GroupDocs.Redaction for Java makes it easy for Java developers to hide private content with a few simple steps.

  1. Start a Redactor and load your Pdf file.
  2. Set up your redaction preferences.
  3. Choose what to find and select your overlay color.
  4. Apply the redaction and save your document.
// Cover text in PDF using colored overlays

// Pass file path to the Redactor
final Redactor redactor = new Redactor("input.pdf");
try
{
    // Adjust redaction settings
    // Set target text and color
    ReplacementOptions opt = new ReplacementOptions(java.awt.Color.RED);
    
    ExactPhraseRedaction redaction = new ExactPhraseRedaction("Text to hide", opt);

    // Apply and save the redacted PDF
    redactor.apply(redaction);
    redactor.save();
}
finally { redactor.close(); }
<dependencies> <dependency> <groupId>com.groupdocs</groupId> <artifactId>groupdocs-redaction</artifactId> <version>24.6</version> </dependency> </dependencies> <repositories> <repository> <id>repository.groupdocs.com</id> <name>GroupDocs Repository</name> <url>https://repository.groupdocs.com/repo/</url> </repository> </repositories>
click to copy
copied
More examples Documentation

Control What’s Visible in Documents

GroupDocs.Redaction for Java lets you block out or remove parts of your files while keeping them easy to view and share.

Powerful Redaction Tools

Target and hide text

Search your document and hide specific words or phrases to protect private info.

Cover images

Add overlays to fully or partially hide visuals.

Remove metadata

Clear hidden document details to avoid unintentional exposure.

Hide Text Using Regex

This example uses regular expressions to find and hide specific content

Java

//  Load the file you want to process
final Redactor redactor = new Redactor("source.pdf");
try
{
    // Set the text pattern and overlay color
    ReplacementOptions repl_opt = new ReplacementOptions(java.awt.Color.BLUE);
    RegexRedaction redaction = new RegexRedaction("\\d{2}\\s*\\d{2}[^\\d]*\\d{6}", repl_opt);
    
    // Apply the redaction
    redactor.apply(redaction);

    // Save your changes
    SaveOptions saveOptions = new SaveOptions();
    saveOptions.setAddSuffix(true);
    saveOptions.setRasterizeToPDF(false);
    redactor.save(saveOptions);
}
finally { redactor.close(); }
<dependencies> <dependency> <groupId>com.groupdocs</groupId> <artifactId>groupdocs-redaction</artifactId> <version>24.6</version> </dependency> </dependencies> <repositories> <repository> <id>repository.groupdocs.com</id> <name>GroupDocs Repository</name> <url>https://repository.groupdocs.com/repo/</url> </repository> </repositories>
click to copy
copied
More examples Documentation

What GroupDocs.Redaction for Java Offers

GroupDocs.Redaction for Java gives Java developers an easy way to hide or remove content from PDF files. Cover up text, images, and metadata across different document types.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Redaction for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Protect PDF Files with Java

Use Java to cover or erase content in PDF documents. A great way to keep private info safe and secure.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English