Redaction
Remove personal data for good, by text, regular expression or built-in pattern.
The redact action removes the matching text from the page content, not only from view, and
covers the area with a black box (or white, with fill_white). What is redacted cannot be copied
or recovered.
mode | query |
|---|---|
text (default) | The exact text to remove |
regex | A regular expression |
pattern | One of email, phone, credit-card, iban, pt-nif, us-ssn, ipv4, url, date |
Cost: 1 unit per action.
Redact a statement
Combine as many redact actions as you need. They run in order.
curl https://api.nexpdf.dev/v1/build \
-H "Authorization: Bearer $NEXPDF_API_KEY" \
-F doc=@statement.pdf \
-F 'instructions={
"parts": [
{
"file": "doc"
}
],
"actions": [
{
"type": "redact",
"query": "iban",
"mode": "pattern"
},
{
"type": "redact",
"query": "Account no\\. \\d+",
"mode": "regex"
},
{
"type": "redact",
"query": "Jane Doe",
"fill_white": true
}
]
}' \
-o redacted.pdfRedact a scan
Scanned pages have no text until they are OCRed, so put ocr first.
curl https://api.nexpdf.dev/v1/build \
-H "Authorization: Bearer $NEXPDF_API_KEY" \
-F scan=@scan.pdf \
-F 'instructions={
"parts": [
{
"file": "scan"
}
],
"actions": [
{
"type": "ocr",
"languages": "eng"
},
{
"type": "redact",
"query": "email",
"mode": "pattern"
}
],
"output": {
"type": "pdf"
}
}' \
-o searchable.pdf