GroupDocs.Redaction for Python via .NET Highlights

Cover Sensitive Text in PDF Using Python

Secure your PDF files with Python. Use overlays to block legal, personal, or confidential info.

Keep Sensitive Info Safe in Pdf Files

Use GroupDocs.Redaction for Python via .NET with your Python via .NET apps to hide private content fast.

  1. Set up a Redactor and load your Pdf file.
  2. Choose how the redaction should work.
  3. Pick the text to hide and select a color for the overlay.
  4. Apply redaction and save your file.
import groupdocs.redaction as gr
import groupdocs.redaction.redactions as grr
import groupdocs.pydrawing as grd

# Hide sensitive text in PDF using color overlays

# Set redaction options
# Define what to hide and pick a color
color = grd.Color.from_argb(255, 220, 20, 60)
repl_opt = grr.ReplacementOptions(color)
        
redaction = grr.ExactPhraseRedaction("Text to hide", repl_opt)

# Load the file by passing its path to Redactor
with gr.Redactor("input.pdf") as redactor:

    # Redact and save your PDF file
    result = redactor.apply(redaction)
    redactor.save()
pip install groupdocs-redaction-net
click to copy
copied
More examples Documentation

Hide or Remove Info from Documents

With GroupDocs.Redaction for Python via .NET, you can hide text, images, and other data in many formats. Protect what matters while keeping your documents easy to read and share.

Flexible Redaction Features

Edit Any Text

Find and replace sensitive text to keep your documents secure.

Cover Images

Use overlays to block out full images or specific areas.

Clean Metadata

Remove hidden data to stop unintentional information leaks.

Use Regex to Find and Hide Text

This example shows how to search and hide text using regex patterns.

Python

import groupdocs.redaction as gr
import groupdocs.redaction.options as gro
import groupdocs.redaction.redactions as grr
import groupdocs.pydrawing as grd

# Set text pattern and overlay color
color = grd.Color.from_argb(255, 220, 20, 60)
repl_opt = grr.ReplacementOptions(color)

redaction = grr.RegexRedaction("\\d{2}\\s*\\d{2}[^\\d]*\\d{6}", repl_opt)

# Load your document
with gr.Redactor("source.pdf") as redactor:

    # Redact selected content
    result = redactor.apply(redaction)

    # Save the updated file
    so = gro.SaveOptions()
    so.add_suffix = True
    so.rasterize_to_pdf = False
    result_path = redactor.save(so)
pip install groupdocs-redaction-net
click to copy
copied
More examples Documentation

About GroupDocs.Redaction for Python via .NET

GroupDocs.Redaction for Python via .NET gives Python developers an easy way to hide or delete content in PDF files. Cover sensitive text, images, or metadata across many formats.
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 Python Tools

Use Python to hide or remove content in PDF files. A reliable way to keep private info safe.

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