by mguhlin

pdfunite on linux

EdTech

Being a bit lazy, I didn’t want to reboot my computer into Windows to join/merge a few zillion PDF files. But how to join them on GNU/Linux?

 

Of course, I wasn’t the first person to ask this question. OMG! Linux had already done so and answered the question. Using the command line, you can use a utility called pdfunite that works like a charm.

If you’re comfortable at the command-line there’s a cool tool most Linux distributions come with that can do this task; or if you’re more comfortable clicking your way around there’s a user-friendly app for the task, available in most distro’s repos.

Here’s the command to join a few PDFs in a terminal window:

pdfunite file1.pdf file2.pdf output.pdf

Then, of course, the question that comes up, what happens if I have a zillion PDF files to merge? What command to use then? Thank goodness, others at Stack Overflow had already solved that one, too.

ls *.pdf |sort -n| bash -c ‘IFS=$’”’”‘\n’”’”’ read -d "" -ra x;pdfunite ”${x[@]}” output.pdf’

And, voila, it worked. A zillion PDFs are merged into one titled output.pdf

I suppose if I got desperate, I could have used the other suggested program, PDF Arranger. I’m going to make a note of how to install it, just in case:

sudo def install pdf-arranger

On a tangent, I was looking for a command line PDF viewer. I settled on MuPDF after a two-second web search (PeppermintOS didn’t seem to have one set to default).

sudo apt-get install mupdf mupdf-tools

Works great!


Everything posted on Miguel Guhlin’s blogs/wikis are his personal opinion and do not necessarily represent the views of his employer(s) or its clients. Read Full Disclosure