Decrypting and concatenating PDFs with qpdf

qpdf docs

I wanted to quickly jot down some of the PDF tasks that the wonderful qpdf has been helping me do. This ranges from merging multiple PDF files to storing decrypted versions of annoying PDFs sent by some banks.

I used to use pdftk till some time back, but it had a lot of dependencies which were a pain to install. I exclusively use qpdf now instead.

Concatenating PDFs

Normally qpdf expects an input file for all operations. But while concatenating PDFs, you would prefer a blank slate to which you will be adding the files. The trick is to use --empty as input, and then add the pages.


This option may be given in place of infile. This causes qpdf to use a dummy input file that contains zero pages. This option is useful in conjunction with --pages.

This following simple syntax to add the pages from other PDF documents to the input file was added a few years back.

If I want to concatenate multiple PDFs into one, I use:

qpdf --empty --pages *.pdf -- out.pdf

Decrypting PDFs

I had mentioned this in a prior blog post a while back (14 years ago! 👴).

qpdf --decrypt --password=mypassword input.pdf output.pdf

I actually now use a script to wrap this, which lets me forget the specific syntax of the command 😄 and also gives me various invocation options as documented at the start of the script.

Publishing helm charts on Artifacthub Converting audio to text from command line using commercial and opensource tools