What You Can Do with GroupDocs.Redaction for Python via .NET

Erase Sensitive Text from PDF Files Using Python

Use Python and GroupDocs.Redaction for Python via .NET to search for and remove private, legal, or personal data from your PDF files.

How to Redact Content in Pdf Files

Keep your content safe in any Python via .NET app using GroupDocs.Redaction for Python via .NET.

  1. Create a Redactor and load your Pdf file.
  2. Choose the redaction settings you want.
  3. Enter the text to search and what to replace it with.
  4. Apply redaction and save your file.
import groupdocs.redaction as gr
import groupdocs.redaction.redactions as grr

# 

# 
# 
repl_opt = grr.ReplacementOptions("[redacted]")
        
redaction = grr.ExactPhraseRedaction("Text to hide", repl_opt)

# 
with gr.Redactor("input.pdf") as redactor:

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

More Redaction Features

GroupDocs.Redaction for Python via .NET lets you hide private content in many file types. Keep your data safe and ready to share.

Tools for text, image, and metadata redaction

Find and Replace Private Text

Search for and swap out matching text. Works with regex and keyword search.

Cover Private Images

Mask full images or parts of them using overlays. Customize appearance settings.

Erase Hidden Metadata

Remove hidden info like author names, timestamps, and revision notes.

Redact with Regex

Use regex to find and remove patterns like emails, IDs, or numbers.

Python

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

# Set a regex pattern and replacement text
repl_opt = grr.ReplacementOptions(color)
emailRegex = "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"

redaction = grr.RegexRedaction(emailRegex, repl_opt)

# Open the file you want to clean
with gr.Redactor("source.pdf") as redactor:

    # Apply your redaction rules
    result = redactor.apply(redaction)

    # Save your redacted 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

What is GroupDocs.Redaction for Python via .NET?

GroupDocs.Redaction for Python via .NET gives Python developers all the tools they need to redact content in PDF files—text, images, comments, and more.
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.

Redact Content in PDF Using Python

Keep personal or business data safe by redacting text in PDF files with Python tools.

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