It is very useful to combine multiple PDF documents into one file. This is useful especially if you accumulate many PDFs (newsletters, bills, etc.) over time.
Preparing Your system
sudo apt-get install gs pdftk
Now we will see one example how to combine pdf files let us assume we have 1.pdf,2.pdf,3.pdf files and now we need to cobmine this files using the following command
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combinedpdf.pdf -dBATCH 1.pdf 2.pdf 3.pdf
In the above command after “-sOUTPUTFILE=” type whatever name you want for the merged file (don’t forget to append .pdf to the end of the file name). Rename “1.pdf 2.pdf 3.pdf” to whatever your file names are (separate your file names with a space).
After you run the above command, a new PDF file called combinedpdf.pdf will be created with your individual files merged according to the order you list.
If you want to know more options available for gs command check man page
Will the appended files be preceded by a pagebreak?
weiß ich leider nicht, müsstest du mal den author fragen
I’m a new ubuntu user. It’s dissapointing that none of the PDF gui programs in the list have this feature.
Works like a sharm, thanks!
Excellent! thanks so much!
Perfect!….just perfect. It even compresses the files a bit. Suited me just fine. Thx.
pdftk a.pdf b.pdf c.pdf cat output abc.pdf
this command is easier to remember.
Works like a charm, thanks!
FTI: To save some typing (filenames) you could also you shell expansions instead:
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combinedpdf.pdf -dBATCH ?.pdf
thanks for that you have just saved me lots of time
if you do this frequently, I’d suggest creating a simple shell script:
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combined.pdf -dBATCH [email protected]
save as /usr/local/bin/combinepdf, make it executable, and run it with:
combinepdf a.pdf b.pdf c.pdf
combinepdf `ls -1 `
Does anyone know how to make it link the files without makin a pages per file. I mean, make them all together like linking pictures. In my case I have pictures of time series and I want to put one above the other, actually I get one page after the other.
This application sucks! I never got it to work or even come up! I’ve uninsulated it and gone with PDF Editor. Perhaps someday there will be a way to use this program without having a programing degree.
Thanks alot….. God Bless
>T. Williams says:
>October 29, 2010 at 11:45 pm
>This application sucks! I never got it to work or even come up! I’ve uninsulated it and gone with PDF >Editor. >Perhaps someday there will be a way to use this program without having a programing degree.
I’m 17 and had no problem with this program. it runs in the terminal. i use ubuntu (as reference). i too found it easier to navigate to the folder then use *.pdf to combine the pdf files. other than that it is a simple copy paste from above. mine is currently still running as i have over 100megs to combine into one but i’m hoping for good results
@Rick Useful idea to encapsulate this into a script, but the argument expansion causes problems if your filenames have whitespace in them; to fix this, quote “[email protected]” so the file reads as follows:
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combined.pdf -dBATCH "[email protected]"
An easier alternative is pdfunite (poppler). You probably already have it installed.
Thanks for this. BTW: the ps command worked fine for me without having pdftk installed.
fabulous !!! fantastic !!! stupendous !!! grateful …………