Last active
February 12, 2026 03:26
-
-
Save taimoorgit/089ada68600517531a30dcf85b2eccd8 to your computer and use it in GitHub Desktop.
How to redact a PDF on macOS - hide sensitive information using Preview, rasterize text using ImageMagick, remove EXIF data using ExifTool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # make a working copy so the original stays untouched | |
| cp TA1.pdf DexaScan.pdf | |
| # open the copy in Preview, delete pages, and use Markup → Redact (choose “Remove Content”), then save | |
| open DexaScan.pdf | |
| # rasterize the pdf to destroy all text layers (non-selectable, non-recoverable) | |
| magick -density 300 DexaScan.pdf Dexa_Scan.pdf | |
| # strip all metadata in place (no backup file) | |
| exiftool -all= -overwrite_original Dexa_Scan.pdf | |
| # verify metadata should be empty | |
| exiftool Dexa_Scan.pdf | |
| # verify no text should be extractable | |
| pdftotext Dexa_Scan.pdf - | |
| # delete sensitive copies | |
| rm TA1.pdf DexaScan.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment