redactor
A PDF redaction library and CLI tool with secure text removal using MuPDF. Redacts Verizon bills so you can expense them without leaking your call metadata.
Use Case
Originally built for redacting Verizon phone bills before submitting them to employer expense reimbursement systems like Concur, or Expensify.
When submitting phone bills for work expense reimbursement, you typically need to:
- ✅ Keep the billing amounts visible (for verification)
- ❌ Remove your account number (privacy/security)
- ❌ Remove personal phone numbers (privacy)
- ❌ Remove call detail information (times, locations, destinations)
- ❌ Remove other personal contact information
This tool ensures your sensitive information is physically removed from the PDF (not just blacked out), so it cannot be extracted by the expense system or anyone who views the document.
Perfect for: Freelancers, remote workers, and employees who need to submit redacted bills for work expenses while maintaining privacy.
Features
- Secure Redaction: Physically removes text from PDFs (not just visual overlay)
- Type3 Font Support: Handles complex PDF encodings via MuPDF
- Phone Number Detection: Automatic NANP phone number redaction
- Verizon Account Numbers: Specialized detection for 9-5 format accounts
- Call Detail Redaction: Automatically redacts time, origination, and destination columns
- Pattern Matching: Literal strings and regex patterns
- CLI & Library: Use as a command-line tool or Rust library
Installation
As a CLI Tool
As a Library
Add to your Cargo.toml:
[]
= "0.2"
Quick Start
CLI Usage
Redact Verizon Bill for Expense Report
# Redact account number, phone numbers, and call details (recommended for expense reports)
This command will:
- Find and remove your Verizon account number (e.g.,
123456789-00001) - Remove all phone numbers from the document
- Remove call detail information (times like "10:26 PM", locations, destinations)
- Preserve billing amounts and other expense-relevant information
Other Common Uses
# Redact only phone numbers
# Redact custom patterns (e.g., email addresses)
# Extract text to verify what's in the PDF
Library Usage
use ;
use Path;
Security
This library uses MuPDF's built-in redaction system to physically remove text from PDFs, making it unextractable. This is more secure than visual-only redaction methods that just draw black boxes over text.
Why This Matters for Expense Reports
Many expense systems (Concur, Expensify, etc.) can extract text from PDFs for automated processing. Simple "black box" redaction doesn't actually remove the text - it's still embedded in the PDF and can be extracted. This tool ensures your account numbers and personal phone numbers are truly gone before you submit to your employer.
Verification
# After redaction, verify text is gone
# Your account number and phone numbers should NOT appear in output
Supported Patterns
Phone Numbers (NANP)
(555) 123-4567555-987-6543555.111.2222+1 555 234 5678
Verizon Accounts
123456789-00001(9-5 format)12345678900001(14 digits)- Context-aware detection
Custom Patterns
- Literal strings
- Regular expressions
- Multiple patterns per run
Command Reference
Default Mode: Redaction
)
Extract Subcommand
)
Examples
Expense Report Workflow
# 1. Download your Verizon bill (e.g., January-2026.pdf)
# 2. Redact sensitive information
# 3. (Optional) Verify redaction by extracting text
# Your account number and phone numbers should NOT appear in the output
# 4. Upload January-2026-redacted.pdf to Concur/Expensify
Redact Multiple Pattern Types
Library: Custom Redaction Strategy
use ;
let service = new;
service.redact?;
Library: Pattern Matching
use ;
let matcher = new;
let phones = matcher.extract_all;
// phones: ["(555) 234-5678", "555-987-6543"]
Performance
- Unit tests: <0.1s (15+ tests)
- Integration tests: ~0.5s (10+ tests)
- Full test suite: <2s (30+ tests)
- Redaction: ~50-80ms per page (typical)
Architecture
redactor/
├── src/
│ ├── domain/ # Business logic (phone, account detection)
│ ├── redaction/ # Redaction strategies (secure, visual)
│ ├── error.rs # Custom error types
│ ├── lib.rs # Library API
│ └── main.rs # CLI application
└── tests/
├── common/ # Shared test utilities
├── unit/ # Fast unit tests
├── integration_test.rs
└── cli_integration_test.rs
Development
Prerequisites
- Rust 1.70+
- MuPDF development libraries
Building
Testing
# All tests
# Specific test suite
# With output
Linting
Limitations
- Requires MuPDF system libraries
- Best results with standard PDF fonts
- Complex annotations may require additional handling
- Scanned PDFs (images) require OCR preprocessing
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
MIT License - see LICENSE-MIT for details.
Acknowledgments
- MuPDF for PDF processing
- lopdf for PDF manipulation
- pdf-extract for text extraction
Security Notice
This tool is designed for legitimate redaction purposes. Users are responsible for:
- Verifying redaction completeness
- Complying with applicable laws and regulations
- Testing output before distribution
- Understanding PDF structure limitations
Always verify redacted PDFs before sharing sensitive documents.