This is an old revision of the document!
Table of Contents
How to merge PDF-files
Introduction
PDF (Portable-Document-Format) is a file format invented by Adobe. PDF is useful to present documents independent of hardware, operating system and application software. Each PDF-file has a fixed layout, including page-size, fonts, graphics and other information. It is also possible to encrypt a PDF file for security, or create a digital signature for authentication.
PDF-documents are created from traditional text-documents via a printer-driver, or as with LaTeX created directly from a source-code. One important consequence is, that one cannot convert a PDF-document “back” into it's original, for example a M$-Word-document.
This Article describes, how one can merge several PDF-documents into one. This is useful for example if you have several pages from the scanner in PDF-format and want to put this files to be in one file like the original text. There are several tools, some included in the stock Slackware-install, some available via slackbuilds.org.
The Tools
At first I will describe the tools which are already available on your Slackware-computer if you have a complete installation.
gs (Ghostscript)
With Ghostscript you can merge PDF-files on the command-line
gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=<newfilename>.pdf <inputfilenameshere>
Thanks to mrclisdue from linuxquestions.org for the contribution.
ImageMagick (convert)
People say that it is also possible, to merge PDF-documents with convert, but I haven't yet found out how this works.
pdftk
pdftk is available at [url=http://slackbuilds.org/repository/14.0/office/pdftk/]slackbuilds.org[/url]. It's also a commandlinetool and the usage is:
pdftk first.pdf second.pdf third.pdf cat output altogether.pdf
pdftk can do more things than joining PDF-files, for example rotating a document by 180 degrees is done this way:
pdftk upsidedown.pdf cat 1-endsouth output rotated.pdf
pdfshuffler
pdfshuffler is also available at [url=http://slackbuilds.org/repository/14.0/office/pdfshuffler/]slackbuilds.org[/url]. It comes with a graphical user interface and is written in Python, therefore pyPdf and pypoppler are required in order to get this program to work. It is very convenient because it shows the pages which are joined. I has additional features like rotating or splitting PDF-files.
pdfjam
pdfjam is a LaTeX-package which is unfortunately not included in tetex. But those of us who have instead texlive installed have already pdfjam. It is also a commandlinetool (like LaTeX). The documentation is available with the texdoc command
texdoc pdfjam
Sources
* Originally written by Markus Hutmacher