Combine PDF Files on Arch Linux
This article was last edited over 3 years ago. Information here may no longer be accurate. Please proceed with caution, and feel free to contact me.
This functionality is provided by the pdfjam
package
on Arch Linux.
# Join multiple pdfs, sorted by alpha
pdfjoin *.pdf
# Join multiple images, sorted by alpha
pdfjoin *.jpg
# Join pdfs as listed
pdfjoin 1.pdf 2.pdf 3.pdf
# Join everything into a pdf
pdfjoin *
I had a number of brief PDF files that I wanted to merge together into a single concatenated PDF. This is the sort of task that typically leads me down a rabbit hole of abandoned scripts and obscure apps.
I found many articles on this subject, which recommended various tools for the job.
The resulting combined file from ghostscript (gs
) had
mangled tables and askew images. Unfortunately, the output was
unusable.
pdftk
sounded promising, but the install process for
Arch is ridiculous. There’s a yaourt package, but it relies
on gcc-gcj
(ugh, java) and
gcc-gcj-ecj
(a fork of the Eclipse bytecode compiler,
double ugh). The compilation time was far more than I cared to
wait for this sort of task, and I eventually killed it.
Imagemagick worked, but their convert
util rendered
text as images so the output PDF was unsearchable. The text was
blurry and for reasons unknown my jobs were being killed when I
tried to use sane values for higher quality results. That seemed
odd considering I’m on a modern machine with ample RAM.
The winner for me was pdfjoin
ala the
pdfjam
package.
It generated a relatively small file, text was rendered properly and was searchable, tables and graphics were properly rendered, and it was high quality.