Editing PDF files on Linux
#380 Henry, Wednesday, 29 January 2020 11:48 AM (Category: Linux)
(Tags: pdf linux qpdf slackware)

Two years ago I bought a Mac software called PDF Expert. It lets me do a lot of things with a PDF file, but on my Macs. My primary desktop is still my Linux Slackware desktop. That's where I do all my work, and email, and browsing. The Macs for me are extra tools that let me do the few things that Linux can't handle.

I get my water bill mailed to me each month. It's encrypted with a sort-of easy password, and it contains 2 pages of guff, 2 pages of the bill, and then two more pages of how-to-pay forms.

I use PDF Expert to decrypt the file and then remove the junk pages. But the workflow is clumsy. It arrives in my mail on my Linux desktop, I shove it into Dropbox, edit it with Expert PDF on the Mac Mini, and pull it back off Dropbox and file it on my Linux desktop. Awkward.

Today I was hopefully looking at the Slackware change log to see if a new release might be coming. It's been three years, maybe longer. Next time I am really tempted to stick with current, rather than stable. But I noticed one package that had been updated in current. qpd. Never seen that before, so I checked and I do have it on my current box, and then checked to see what it was.

Well, holy hell. It's a command line tool for manipulating PDFs. It takes an input PDF, changes it, and produces an output file. I can use it to decrypt a PDF and remove the encryption, ignore the first two pages, copy the next two, and ignore the remaining pages.

Like this:

$ qpdf water_2018_12.pdf --decrypt --password=axolotl --pages water_2018_12.pdf 3-4 -- water_2018_12_fixed.pdf

No need to transfer it to the Mac anymore, just do it in one pass on my Linux desktop. Except, I have to write down the command to remember it, except I think I will create a shell script called fix_water_bill.sh and put it in that.

I still use PDF Expert after scanning to rotate pages. The scanner has auto-rotate and will adjust pages itself, but this proved really clumsy when doing magazines because pages just went haywire. I turned it off. I should turn it on when doing documents and turn it off again when doing magazines.

But I scan on a Mac, edit the PDFs on the Mac, then transfer them into Dropbox (now), so the workflow is fine.

But anyway, I have another tool in my arsenal now, to make quick adjustments to documents under Linux. Nice.