Home > software > Combining many PDF files into one

Combining many PDF files into one

Image

Combining (or merging or whatever you call it) two or more PDF files into a single output PDF is very easy to do without needing to pay for anything provided you can do simple typing.

This contradicts various web advice sites, how-to and so on where surprise surprise the solution is buy this or that.

Unix users, BSD, Linux, OSX probably won’t need telling but the following with slight changes works there too.

I often use Method 2 but for this is horses for courses, why we have a brain.

I’ve written this without assuming the reader is much of an expert, might be talking down.

Method 1 if bitmap graphical output is wanted

Inherently PDF is postscript inside and is vector format but can show bitmaps at fixed resolution.

Imagemagick has this facility.

Usually this is done from numbered input files, the incantation to type looks similar to this

convert page-*.pdf result.pdf

The dash is of no significance. Any file page-<number> followed by .pdf

Spooky trivial but the tool sometimes guesses incorrectly what the human meant. Wrinkles such as

file-1.pdf
file-10.pdf
file-2.pdf

You need to number with textual collation in mind, not numeric,

file-01.pdf
file-02.pdf

file-10.pdf

Various overrides may be needed, read the documents, lots and lots of them.

http://www.imagemagick.org/script/index.php

Actually will combine almost anything graphic as input. Hint, can do paged PDF of images, a bit like a slide show or presentation.

Is a monumental tool, little it cannot do… if you can figure out how to drive it. Any operating system. Permissive licence. Very widely used. Genuinely free. Does need installing.

Method 2, use Ghostscript

Personally I use a tiny program (or script not shown here) to create the following instructions, makes my life easier, saves typing.

Here is written longhand, showing an easy and straightforward way to do it.

For Windows (assume for now what follows will work)

>”C:\Program Files\gs\gs9.05\bin\gswin32c.exe” @cmdfile.txt

The quotes are needed if the path contains spaces. gswin32c is the command line (console) version.
You will have to find the full disk path on your system and use that.

cmdfile.txt (which you text edit, you make it) contains similar to the following real example

-dBATCH
-dNOPAUSE
-sDEVICE=pdfwrite
-sOutputFile=.\2013_11_03_18\pages.pdf
.\2013_11_03_18\page-01.pdf
.\2013_11_03_18\page-02.pdf
.\2013_11_03_18\page-03.pdf
.\2013_11_03_18\page-04.pdf
.\2013_11_03_18\page-05.pdf
.\2013_11_03_18\page-06.pdf
.\2013_11_03_18\page-07.pdf
.\2013_11_03_18\page-08.pdf
.\2013_11_03_18\page-09.pdf
.\2013_11_03_18\page-10.pdf
.\2013_11_03_18\page-11.pdf
.\2013_11_03_18\page-12.pdf
.\2013_11_03_18\page-13.pdf
.\2013_11_03_18\page-14.pdf
.\2013_11_03_18\page-15.pdf
.\2013_11_03_18\page-16.pdf

Preamble, name of output and a list of input files, perhaps with full or relative paths (as this example). Remember to quote any paths containing spaces. Seems to work with either path separator \ or / a source of many troubles between Windows and Unix.

Although the example above uses numbered files this method will accept anything, are used in the sequence given in the file.

Lots of different ways to achieve the same thing once you know the important definite fact: it can be done.

Various overrides etc. can be used, read the documents.

Now for the downside. Ghostscript has to be installed. It is GPL or commercial licenced which poses problems for some people.

There are maybe three different incarnations and many versions.

Ready for head spin time?

Ghostscript is a copyrighted work; it is not shareware or in the public domain.

Versions entitled GPL Ghostscript are distributed with the GNU General Public License, which allows free use, and free copying and redistribution under certain conditions (including, in some cases, commercial distribution). A supported commercial version is available from Artifex Software Inc.

Releases made prior to 2004 were part of the GNU project and were titled GNU Ghostscript; that project now maintains a fork. Versions prior to 8.54 were released first under a more restrictive license as AFPL Ghostscript.

http://www.ghostscript.com/Ghostscript.html

I will give a link for download, whether you trust me is another matter. http://www.ghostscript.com/download/

Postamble

Some advice: be very wary of freely offered PDF tools of any kind, not everyone is nice.

Are there valid fancy tools? Of course. GUI, of course. Free lunch? Not often.

Advertisements
Categories: software
  1. No comments yet.
  1. No trackbacks yet.

Leave a reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: