When working with PDF documents or scanned images, it’s a pretty common task to merge them to PDF. We have been doing these things using imagemagick and ghostscript for years. But we had to compromise with a few serious drawbacks of that process including converting PDF pages into image snapshot and increasing file size. So, eventually, I have written merge2pdf a tiny cli tool for this job (and a few extra).
This post is to show some example usages (commands) of this tool for different scenarios.
Before diving into commands, let’s go through a list of highlights of this tool.
- Lossless quality by default. Option to adjust JPEG quality
- Can be merged all pages or only specific pages of PDF
- Supports a wide range of image formats
- Options to adjust size, margin, and scaling of images
- Supports directory as input (merges all Images/PDFs of a directory)
- Free and open source
- Very simple and easy to use