#pdf #terminal #tools

A while ago, I needed a terminal solution to merge different PDF files into a single file.

You can use the tool pdfunite from the poppler package to do this.

First, you need to install it. This depends a little on the platform you are using:

Install on mac

1$ brew install poppler

Install on Ubuntu Linux

1$ sudo apt install poppler-utils

After the install, you can inspect how it works by running it's help command:

 1$ pdfunite -?
 2pdfunite version 20.11.0
 3Copyright 2005-2020 The Poppler Developers - http://poppler.freedesktop.org
 4Copyright 1996-2011 Glyph & Cog, LLC
 5Usage: pdfunite [options] <PDF-sourcefile-1>..<PDF-sourcefile-n> <PDF-destfile>
 6  -v             : print copyright and version info
 7  -h             : print usage information
 8  -help          : print usage information
 9  --help         : print usage information
10  -?             : print usage information

So, we can easily combine PDF files now using:

1$ pdfunite pdf1.pdf pdf2.pdf combined_pdf.pdf

Thanks to StackOverflow for helping me finding this out :)