Expand description
Production-grade PDF redaction library with secure text removal.
This library provides secure PDF redaction with support for complex text encodings including Type3 fonts. It uses MuPDF’s redaction API to physically remove sensitive information from PDF documents.
§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
- Pattern Matching: Literal strings and regex patterns
§Architecture
domain: Business logic for pattern matching (phone numbers, accounts)redaction: Redaction strategies and service layererror: Comprehensive error handling
§Quick Start
use redactor::{RedactionService, RedactionTarget};
use std::path::Path;
let service = RedactionService::with_secure_strategy();
service.redact(
Path::new("input.pdf"),
Path::new("output.pdf"),
&[RedactionTarget::PhoneNumbers]
)?;§Examples
§Redact Verizon Account Numbers
use redactor::{RedactionService, RedactionTarget};
use std::path::Path;
let service = RedactionService::with_secure_strategy();
service.redact(
Path::new("bill.pdf"),
Path::new("redacted.pdf"),
&[RedactionTarget::VerizonAccount]
)?;§Pattern Matching
use redactor::domain::{PhoneNumberMatcher, PatternMatcher};
let matcher = PhoneNumberMatcher::new();
let text = "Call (555) 234-5678 or 555-987-6543";
let phones = matcher.extract_all(text);
assert_eq!(phones.len(), 2);Re-exports§
pub use domain::PatternMatcher;pub use domain::PhoneNumberMatcher;pub use domain::VerizonAccountMatcher;pub use domain::VerizonCallDetailsMatcher;pub use error::RedactorError;pub use error::RedactorResult;pub use redaction::RedactionResult;pub use redaction::RedactionService;pub use redaction::RedactionStrategy;pub use redaction::RedactionTarget;pub use redaction::SecureRedactionStrategy;