Redact PDFs in Python
The Apryse Server SDK runs PDF redaction in Python in two steps. Search the document and mark matches with redact annotations, then apply them to permanently remove the text, images, and vector content inside each region. Redaction is an add-on package on your Server SDK license key. Sanitization, in the base package, removes metadata and hidden content.
What Redaction Does to a PDF in Python
Applying a redaction destroys the text, images, and vector content inside each marked region. The Server SDK does not hide that content behind clipping or image masks, so nothing in the region survives a copy or a file conversion. That is true redaction rather than visual masking.
Redaction rarely ships alone. Scanned pages need OCR before there is text to match, and hidden file data needs sanitization.
Search, Mark, Apply: The Two-Step Model
Call PDFNet.Initialize() with your license key before any other SDK call, once, at process startup. Read the key from the APRYSE_LICENSE_KEY environment variable, not from source.
Step one identifies the content and redact annotations mark the regions or text to remove. You can create them interactively, or programmatically through TextSearch or TextExtractor. Until step two runs, you can still see, move and redefine every annotation.
Step two removes it using Redactor.Redact() to apply the regions and destroy the content inside them. Applying is irreversible, so write the output to a new file and keep the original.
Redaction ships in the base Server SDK binary but needs the Redaction add-on license. See Capabilities for licensing. This example uses the Apryse Server SDK with Python 3 on Windows, Linux and macOS; for other languages, see the Server SDK get-started guide.
Read the redaction guide for the API. The Python redaction walkthrough covers the code line by line, and the redaction sample has the full program.
Matching What You Need to Remove
Search finds the content you mark. The Server SDK supports four match types: exact string, ambient string, wildcard, and regular expression. Social Security Numbers and credit card numbers are the documented pattern examples. Any other format you write as a regular expression, such as an account or matter number, uses the same search. See pattern and RegEx matching in the developer guide.
Verifying the Content Is Gone
A black box on screen is not proof that the information is not accessible. Save the applied output to a new file, then run search or extraction on it. Both are base package capabilities, and every redacted string should return no matches. Make it a pipeline step, so no output file ships without it.
Where Python Runs This
Python is a native language binding on the Apryse Server SDK. It calls the same C++ core as the Java and C# bindings, with matching initialization, document operations and locking model. The SDK is self-hosted: it runs on your on-premises servers, cloud VMs or containers, and no document content goes to Apryse.
Another language? See redaction in C# with the .NET get-started guide, or redaction in Java with the Java get-started guide.
For redaction that runs in the browser, use the Apryse Web SDK.

Constraints and First Failures
Missing Redaction Package:
Redaction needs the Redaction Package on your production license key. Trial keys include every package. A production key holds only what you licensed, so confirm the package is on it before you deploy.
Uninitialized PDFNet:
Any SDK call made before PDFNet.Initialize() fails. Put the call in your service's startup path.
Scanned pages:
A scan has no text layer, so search finds nothing to mark. Run OCR first, then search the recognized text. Handwriting needs the Handwriting ICR Module instead of OCR. See redacting scanned documents.
Redacting a Document Set in Python
Run the same search, mark, apply, and verify sequence for each document inside your own loop. The Server SDK provides no work queue, job scheduler or batch orchestration, so your service owns the loop, the concurrency and the retry policy.
Operations are stateless per document, so sequential, threaded, multi-process, and scaled-out designs all work. Give each worker its own document or lock a shared one with the documented locking APIs. For volume patterns, see redacting documents in bulk.
What Redaction Does Not Remove
Redaction removes visible page content and nothing else. Metadata, XMP, embedded scripts, form data and hidden layers stay in the file. Sanitization removes them, sits in the Server SDK base package, and needs no add-on license.
A file that is redacted but not sanitized keeps its document properties and other hidden data. Read redaction versus sanitization for the distinction and PDF sanitization for the operation.
Support Matrix
Evaluation Handoff
Financial services, healthcare, government, and legal teams use this operation to prepare documents for release. Read about enterprise-grade redaction or browse redaction use cases by industry.
Four facts cover an evaluation:

Deployment:
Self-hosted, inside your infrastructure.
Licensing:
Redaction is an add-on package on the Server SDK key, sanitization is base, and OCR for scanned input is a separate add-on.
Orchestration:
The SDK provides no queue or scheduler, so your team owns the loop.
Ownership:
Apryse supplies the redact operation. Your application decides what gets redacted, who approves it, where files live and how results are audited.