Combine Single Page PDFs into One File

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply

Combine Single Page PDFs into One File

Post by oddball508 »

I am trying to combine a large number of sets of single page PDF files into multi page PDF files.

I can create a MSAccess routine to cycle through a database, get the name of a PDF file and combine it into another PDF using ImageMagick but the resulting file has two problems.
First: The resulting file is much larger than the combine sum of its parts (36KB+38KB+73KB+80KB+62KB=8,110KB!)
Second: The original pages are of different sizes and as a result each page in the resulting file are resized to a combined maximum area on all pages. (eg If I combined two A4 pages where one is landscape and one is portraite then both pages in the final file would be 297mm x 297mm). this does not deform the picture but does leave a lot of white space to one side of the image.

Any ideas on how to do this?
User avatar
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

You can create uniform page sizes with the -page option (e.g. -page 612x792). To reduce the image size, use -compress (e.g. -compress zip).

Post by oddball508 »

Thanks the size issue has been solved when I used...

imgobj.Convert "d:\ABC\1\1\*.pdf", "-adjoin", "d:\ABC\1\ABC-1-1-pdf.pdf"

But this still created a very large file. If I use the compress option then there is way to many artifacts in the final product.

Post by kim_earth »

Can you tell me how I can run this command using Imagemagick for linux?

I also need to combine single page pdfs into a multi page pdf.

If I try *.pdf -adjoin hi.pdf

alot of whitespace and 2 tiny tiny images on seperate pages..
any other options I need?

thanks in advance..
Last edited by kim_earth on 2010-06-07T08:20:27-07:00, edited 1 time in total.

My solution

Post by oddball508 »

I used PDFTK >>

pdftk.exe 1.pdf 2.pdf cat output 12.pdf
Post Reply