For this purpose we need ghostscript, but basically this software comes pre-installed in most linux distribution.
So to concatenate multiple PDFs (file1.pdf, file2.pdf, file3.pdf), into one file (output.pdf), simply run this:
$ gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf file1pdf file2.pdf file3.pdf
Yes, it’s a long command, I know. To change the output paper size we can replace “a4” with “legal” for US Legal or “letter” for US Letter.
Posted by ariandy on October 11, 2012
First of all make sure you have
imagemagick installed, otherwise checking won’t hurt:
$ sudo apt-get install imagemagick
Then in this case, I would like to join multiple image files of scanned documents with sortable file names (e.g. file01.jpg, file02.jpg, etc.). Finally to join those files together in A4 PDF format we do this in terminal:
$ convert -page A4+0+0 file* OutputFile.pdf
Posted by ariandy on March 8, 2012
This post is inspired (and 68% taken) from here. 😀
There are times when you need to combine multiple PDF files into one single PDF file. In Windows or Mac, it’s easy (as long as you are willing to spend some amount of money to buy the software), you can use Adobe Acrobat Professional. Sadly Adobe didn’t come up with Acrobat Professional for Linux platform, but luckily we have several options to do such job in a Linux box. Here’s one.
GhostScript is an interpreter for PostScript language and PDF files, and as far as I know, GhostScript is widely available by default on various Linux distro. In this post I will show you a simple trick to use GhostScript to combine any numbers of PDF files into one single PDF file. Although combining files with GhostScript has its own drawbacks, but still, for most purposes GhostScript does the job well.
Here’s the voodoo mantra, spell them on Linux terminal:
$ gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf ...
And below is the explanation of each mantra:
The GhostScript program.
tells the program to exit after finishing the job.
tells the program to keep going without having conversation with the user.
tells the program to use its internal PDF writer to process the files.
tells the program where to put those scattered PDF files into one file whom name you specified.
- file1.pdf file2.pdf …
tells the program which PDFs you want to combine.
Tada, now you have combined PDF file, ready to brought anywhere without worry leaving one part behind.
Posted by ariandy on November 17, 2010