How I batch apply and save one-liners

submited by
Style Pass
2024-09-21 19:00:07

My significant other needed to share proof of address by providing a number of bank statements for a period of time. That's easy enough to download as pdfs from the bank, but statements typically provide more personal information than the recipient requires. For a proof of address, the first page is more than enough.

macOS's Preview app can easily delete pages from a pdf by selecting undesired pages and hitting the delete key. This is fine for one pdf but for a handful of them, I figured there's a command line incantation I could use out there, and indeed there is:

Other than show it in action, it may be worh mentioning dwim-shell-command recognizes files in region (in addition to dired's mark of course), so you can just select and apply.

Saving these commands for future usage typically consists of merely wrapping in an Emacs command so we can invoke via M-x (and your favorite narrowing framework for that fuzzy quick magic).

While there's no way I'll remember qpdf my.pdf --pages . 1 -- my-one-page.pdf, I can easily find it in the future by searching with something like M-x keep page.

Leave a Comment