GroupDocs.Redaction for Python via .NET Features

Hide Images in PDF Files with Overlays Using Python

Keep personal and business images secure in PDF files with Python. Our tools make data protection easy and reliable.

Protect Sensitive Data in Pdf Files

GroupDocs.Redaction for Python via .NET gives your Python via .NET apps the ability to protect documents. Hide private content with just a few clicks.

  1. Create a Redactor object and point it to the Pdf file.
  2. Adjust settings to match your redaction needs.
  3. Select which image area to cover and choose an overlay color.
  4. Process and save the redacted file.
import groupdocs.redaction as gr
import groupdocs.redaction.redactions as grr
import groupdocs.pydrawing as grd

# Cover confidential image parts in PDF

# Set up overlay color and size
replacement_size = grd.Size(100, 100)
color = grd.Color.from_argb(255, 220, 20, 60)
replacement_options = grr.RegionReplacementOptions(color, replacement_size)

# Choose the area to redact
replacement_point = grd.Point(200, 200)
redaction = grr.ImageAreaRedaction(replacement_point, replacement_options)
        
# Load the document using the Redactor
with gr.Redactor("input.pdf") as redactor:

    # Apply the overlay and save the document
    result = redactor.apply(redaction)
    redactor.save()
pip install groupdocs-redaction-net
click to copy
copied
More examples Documentation

Hide Sensitive Content in Documents

With GroupDocs.Redaction for Python via .NET, you can hide or erase data in different file formats. Protect sensitive information while keeping documents clean and shareable.

Key Redaction Functions

Search & Edit Text

Find and change sensitive text in your document to protect private information.

Cover Image Areas

Place overlays on images or selected parts to hide confidential visuals.

Manage Metadata

Remove or edit hidden metadata to prevent unwanted data leaks.

Hide Image Information with Overlays

This example shows how to cover sensitive image data in documents using overlays.

Python

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

# Adjust overlay settings: size, color, and location
replacement_size = grd.Size(300, 30)
color = grd.Color.from_argb(255, 220, 20, 60)
replacement_options = grr.RegionReplacementOptions(color, replacement_size)
replacement_point = grd.Point(20, 125)
redaction = grr.ImageAreaRedaction(replacement_point, replacement_options)

# Pick the image area on the first page
redaction.filters = [
    grr.PageRangeFilter(grr.PageSeekOrigin.BEGIN, 0, 1),
    grr.PageAreaFilter(grd.Point(0, 300), grd.Size(600, 600))
]

# Open the file for redaction
with gr.Redactor("source.pdf") as redactor:

    # Apply the overlay to conceal the image
    result = redactor.apply(redaction)

    # Save the redacted file
    save_options = gro.SaveOptions()
    save_options.add_suffix = True
    save_options.rasterize_to_pdf = False
    result_path = redactor.save(save_options)
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 the tools to hide or delete content in PDF files. Cover text, images, and metadata to protect documents in different 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

Use Python to hide or delete sensitive data in PDF files. A practical solution for securing business and private documents.

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