this post was submitted on 04 Jan 2024
144 points (99.3% liked)
Piracy: ꜱᴀɪʟ ᴛʜᴇ ʜɪɢʜ ꜱᴇᴀꜱ
54565 readers
467 users here now
⚓ Dedicated to the discussion of digital piracy, including ethical problems and legal advancements.
Rules • Full Version
1. Posts must be related to the discussion of digital piracy
2. Don't request invites, trade, sell, or self-promote
3. Don't request or link to specific pirated titles, including DMs
4. Don't submit low-quality posts, be entitled, or harass others
Loot, Pillage, & Plunder
📜 c/Piracy Wiki (Community Edition):
💰 Please help cover server costs.
Ko-fi | Liberapay |
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
There are some free, open-source command line tools that can do this.
First off, there's exiftool. It's the go-to utility to read and write metadata in a wide variety of file types, like mp3, jpg, and you guessed it, pdf. It's very easy to use:
To read all the metadata in a file:
exiftool -a -All <file>
(where is the path to your pdf).To erase all the metadata in a file:
exiftool -a -All="" <file>
(that's two double-quotes, to indicate a blank string). Please note that this will overwrite your file in-place! If you want to save the output as a new file, useexiftool -a -All="" -o <output_file> <file>
.exiftool is likely all you need for your use case, but if you need more advanced PDF manipulation, with a truly dizzying array of options, there's Ghostscript. Ghostscript can read, write, and convert PDFs, and provides hooks to apply any PostScript commands and options.
To simply print out information on a PDF file:
gs -dPDFINFO -dBATCH <file>
. This will show you the metadata, such as author, title, etc.I'm...not going to give you an example of how to use Ghostscript to edit metadata because I'm not confident I'd get it right. The gist is that you use PostScript commands with the -c flag. It is truly arcane but extraordinarily powerful.
If you're on Linux, you can likely get both of these with your distro's default package manager. On Mac, use Homebrew or MacPorts. On Windows, you can download prebuilt binaries from their web sites. I think you can even run them on Android using ~~Tmux~~ Termux.
I believe you're referring to Termux, the terminal app. Tmux is a terminal multiplexer. Although you can run Tmux in Termux, so technically...
Anyway, great post! It seems I have to check out Ghostscript, don't think I've ever heard of it, thanks.
Yes, thanks! I did indeed mean Termux. I'll edit my post.