Encrypt, decrypt and process your PDFs with QPDF

QPDF

If you need to process your PDFs then there’s no shortage of free options. JPDF Tweak alone can crop or rotate pages, apply text and image watermarks, encrypt, decrypt them, and so on. You’ve probably come across similar toolkits yourself.

Even the best of these programs will have some gaps in its functionality, though: some security options missing, limited batch processing, inflexible split or merge tools, maybe can’t create linearized (web-friendly) PDFs. And so sometimes, just occasionally, you’ll need a heavy-duty solution like the command line QPDF.

Encryption here isn’t just about giving your file a single password. You’re able to set both user and owner credentials, select a key length (40, 128 and 256), and take very precise control over what the viewer can do. For example, there’s not just a document "can/ can’t modify" toggle: you can also explicitly allow or deny comment authoring, form completion and document assembly.

This isn’t too difficult to set up, either. A command like

qpdf –encrypt user-password owner-password 40 –print=n - test.pdf test2.pdf

will take a file test.pdf, give it a 40-bit key, assign user and owner passwords, and disable printing, before exporting the results as test2.pdf.

QPDF has a vast range of split and merge features. It can combine all the files in a folder (*.pdf), or just a select few; you’re able to extract individual pages, or regular/ reversed page ranges (10-8 would import 10, then 9, then 8); this works with encrypted pages, as long as you provide a password; and you can even apply the metadata from one of the files to the exported result.

Linearized files can be useful, especially if they’re large, as the first page should be viewable in a browser without it needing to download the whole file. Your current PDF creator can’t produce them? In QPDF, it’s as easy as

qpdf –linearize InFile.pdf OutFile.pdf

The program has some useful tools built in. It will automatically try to recover damaged files, for instance, so even if the command has no other processing -- qpdf file.pdf repaired.pdf just tries to read file.pdf and write it as repaired.pdf -- it could still be very helpful.

There are also many more advanced options. If you’d like to view or control stream compression and normalization, maybe view the raw data of document objects, there’s a command to get it done.

This does mean there are plenty of command line switches to learn, of course, but QPDF does at least provide plenty of assistance. Just type qpdf –help to see a good summary of everything you need to know.

Comments are closed.

© 1998-2024 BetaNews, Inc. All Rights Reserved. Privacy Policy - Cookie Policy.