Redact text
redact_pdfPermanently remove specified words or phrases from a new PDF copy by covering each occurrence with a box and deleting the underlying text, so it cannot be selected, searched, or copied.
Instructions
Permanently blacks out (or whites out) every occurrence of the given words or phrases in a new copy of a PDF: each is covered with a box and the text underneath is removed from the file, so it cannot be selected, searched or copied. Use it for names, numbers or other content visible on the pages; for hidden information such as the author, use remove_metadata (often both before sharing), and use search_pdf first to check what will be hit. Something under a box that cannot be cut (an image or scan) is converted to an image when flatten_unsafe is true, otherwise left hidden and reported. Returns the number of occurrences redacted; nothing is written when none is found. The original is not changed, and an existing output file is only replaced with overwrite: true. Encrypted PDFs cannot be saved.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path of the PDF. | |
| color | No | Box colour (default black). | |
| terms | Yes | Words or phrases to redact. | |
| output | Yes | Absolute path of the new PDF. If the file exists, the call fails unless overwrite is true. | |
| password | No | Password, if the PDF is encrypted. Without it an encrypted PDF cannot be opened; with it, it can be read, but tools that write a new PDF cannot save it. | |
| overwrite | No | Allow replacing an existing file (default false). | |
| match_case | No | Only match the exact upper/lower case (default false). | |
| flatten_unsafe | No | Convert pages with content that cannot be cut to images (default false). |