# Redact, Sanitize, and Optimize PDF Files

Redact, Sanitize, and Optimize PDF Files on Evotec with installation guidance, setup notes, reference details, and project documentation.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice)

Stars**750**

Forks**87**

Open issues**8**

PowerShell Gallery downloads**5533821**

Release**v3.6.2**

Language: C# Updated: 2026-11-28

Documentation

Remove sensitive content by detected coordinates, sanitize interactive structures, and optimize a verified delivery copy.

Redaction, sanitization, and optimization are separate operations. Redaction removes selected content. Sanitization removes or normalizes risky document structures according to policy. Optimization changes representation to reduce or simplify the file.

## Redact detected text

Use `Get-OfficePdfRedactionPlan -Text` when you want to preview the matching areas, or pass the same literal text directly to `ConvertTo-OfficePdfRedacted`:

```powershell
Get-OfficePdfRedactionPlan -Path '.\Incident.pdf' -Text 'Secret account'

ConvertTo-OfficePdfRedacted `
    -Path '.\Incident.pdf' `
    -OutputPath '.\Incident-Redacted.pdf' `
    -Text 'Secret account'
```

The [redact-detected-text recipe](https://github.com/EvotecIT/PSWriteOffice/blob/main/Examples/Pdf/Recipe-Pdf-RedactDetectedText.ps1) shows the same operation with a self-contained source PDF.

## Prepare a delivery copy

`ConvertTo-OfficePdfSanitized` writes a new sanitized file. `ConvertTo-OfficePdfOptimized -PassThruReport` reports the actions and size outcome. Neither should overwrite the only source copy in an auditable workflow.

The [sanitize-and-optimize recipe](https://github.com/EvotecIT/PSWriteOffice/blob/main/Examples/Pdf/Recipe-Pdf-SanitizeAndOptimize.ps1) keeps the source, sanitized copy, and optimized delivery file separate.

Visual black boxes are not automatically secure redactions. Use the redaction command and verify extracted content rather than relying on a stamp or shape to hide text.

<!-- PowerForge markdown artifact sha256:3C86A5EE4DACC3C5CDC0253F84620601F8533428F71D4DC0375D30D896C805F5 -->
