Preset Patterns
Processor lets you create redactions on top of text matching predefined patterns, such as email addresses, URLs, and more. To create redactions like this, use a createRedactions
operation with a preset
strategy, like so:
{ "type": "createRedactions", "strategy": "preset", "strategyOptions": { "preset": "email-address" } }
For a complete list of presets, see the Available Operations guide.
Applying Redactions
After redaction annotations are created, they need to be applied to the document to effectively and permanently remove the covered content. You can achieve this by adding the applyRedactions
operation to the operations pipeline.
ℹ️ Note: The
applyRedactions
operation is always executed as the last step in the operations pipeline, regardless of its actual position in the list of operations.
See the following sections for usage examples. Before you get started, make sure Processor is up and running.
Creating and Applying Redactions in a File on Disk
Send a request to the /process
endpoint, attaching an input file and the operations JSON:
curl -X POST http://localhost:5000/process \ -F file=@/path/to/example.pdf \ -F operations='{ "operations": [ { "type": "createRedactions", "strategy": "preset", "strategyOptions": { "preset": "email-address" } }, { "type": "applyRedactions" } ] }' \ -o result.pdf
POST /process HTTP/1.1 Content-Type: multipart/form-data; boundary=customboundary --customboundary Content-Disposition: form-data; name="file"; filename="example.pdf" Content-Type: application/pdf <PDF data> --customboundary Content-Disposition: form-data; name="operations" Content-Type: application/json { "operations": [ { "type": "createRedactions", "strategy": "preset", "strategyOptions": { "preset": "email-address" } }, { "type": "applyRedactions" } ] } --customboundary--
This will create redaction annotations and apply them to the file, removing the content beneath them.
Creating and Applying Redactions in a File from a URL
Send a request to the /process
endpoint and include a URL pointing to the file you want to redact:
curl -X POST http://localhost:5000/process \ -F url=https://pspdfkit.com/downloads/examples/credit-card-application.pdf \ -F operations='{ "operations": [ { "type": "createRedactions", "strategy": "preset", "strategyOptions": { "preset": "email-address" } }, { "type": "applyRedactions" } ] }' \ -o result.pdf
POST /process HTTP/1.1 Content-Type: multipart/form-data; boundary=customboundary --customboundary Content-Disposition: form-data; name="url" https://pspdfkit.com/downloads/examples/credit-card-application.pdf --customboundary Content-Disposition: form-data; name="operations" Content-Type: application/json { "operations": [ { "type": "createRedactions", "strategy": "preset", "strategyOptions": { "preset": "email-address" } }, { "type": "applyRedactions" } ] } --customboundary--
This will create redaction annotations and apply them to the file, removing the content beneath them.