Skip to content

Instantly share code, notes, and snippets.

@taimoorgit
Last active February 12, 2026 03:26
Show Gist options
  • Select an option

  • Save taimoorgit/089ada68600517531a30dcf85b2eccd8 to your computer and use it in GitHub Desktop.

Select an option

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
# 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