19

I have several A4 PDF documents which I would like (two into one) "glue" together into A3 format PDF document. So I will get from 2PDFs A4 a single one sided PDF A3. I have found the excellent utility PDFToolkit and some others but none of them can be used to "glue" side by side two documents.

Charles Stewart
  • 11,185
  • 4
  • 43
  • 84
Drejc
  • 13,466
  • 15
  • 65
  • 101

11 Answers11

17

I just came across a nice tool on superuser.com called PDFjam that can do all of the above in a single command:

pdfjam --nup 2x1 file1.pdf file2.pdf --outfile DONESKI.pdf

It has other standard features like page size plus a nice syntax for more sophisticated collations of pages (the tricky page re-ordering necessary for true booklet-style page imposition).

It's built on top of TeX which is, whatever it is. Installing is a breeze on Ubuntu: you can just apt-get install pdfjam. On Mac OS, I recommend getting BasicTeX (google "mactex basictex"; SO thinks I'm a spammer and won't let me post the link).

This is a lot easier and more maintanable than installing both pdftk and Multivalent (on both Mac OS for dev and Ubuntu for deploy), which wasn't going so well for me anyway...!

Adam Florin
  • 1,335
  • 1
  • 11
  • 12
  • pdfjam / pdfnup can be tricky sometimes. If it reports that calling pdflatex failed and the source pdf contains landscape pages, try to rotate them to portrait (e.g. by using pdftk) before calling pdfjam. – Silpion Feb 06 '13 at 20:28
  • In order to obtain an arbitrary output paper size (horizontal A0 strip) from two 420mm x 420mm PDFs, I had to supply `--papersize '{420mm,841mm}' --trim '0mm 0mm -0.5mm 0mm` to `pdfnup` in addition to `--nup 2x1`. – Ayberk Özgür Aug 09 '16 at 13:45
11

Found the following (free and open-source) tool for doing Imposition called Impose (thanks danio for the tip). This solved my problem perfectly.

EDIT: Here is how it's done:

Use PDF Toolkit to joint two PDF files into one (two A4)

pdftk File1.pdf File2.pdf cat output OutputFile.pdf

Create from this a single page (one A3):

java -cp Multivalent.jar tool.pdf.Impose -dim 2x1 -verbose -paper-size "42.2x29.9cm" -layout "1,2" OutputFile.pdf
Community
  • 1
  • 1
Drejc
  • 13,466
  • 15
  • 65
  • 101
  • 4
    All releases of Multivalent linked from the official sourceforge site are missing the tools package. Links to older versions can be found here: http://sourceforge.net/projects/multivalent/forums/forum/252478/topic/3442363 – beerbajay Oct 05 '10 at 00:08
  • The tools no longer seem to be at that link. I was able to find what seems to be an old copy, but am a little scared to run it, since it could be a trojan. cksum Multivalent.jar gives 571900416 2716363 Can anyone verify that this file with this checksum is legit? – Ben Crowell Jan 29 '13 at 18:39
  • Have you tried the older versions found on sourceforge? Like this one: http://sourceforge.net/projects/multivalent/files/multivalent/Release%2020060102/ – Drejc Jan 30 '13 at 13:02
5

I would like to advertise my pdftools

It's written in Python so should run on any platform. It's a wrapper to Latex (the pdfpages packages) but can do lot of things with a single command line: merge pdf files, nup them (multiple input pages per output page) and number the pages of the output file (you specify the location and the format of the number) It still needs some work but I think it's quite stable to be usable right now :)

robertspierre
  • 1,669
  • 1
  • 19
  • 23
  • I think this one is the most useable for me. I don't want to search the internet for old versions (Multivalent) nor compile something (podofo) nor fiddle with ps. Pdfjam didn't work for me as is does not support things like 5x2 grids or so. Thanks! – Wauzl Feb 23 '17 at 09:02
4

This puts two landscape letter pages onto a single portrait letter sheet, to be "bound" (i.e., folded) along the top.

pdftops $1 - | 
psbook | 
pstops -w11in -h8.5in '4:1@.65(.5in,0in)+0@.65(.5in,5.5in),2U@.65(8in,5.5in)+3@.65U(8in,11in)' | 
ps2pdf - $(basename $1 .pdf).psbook.pdf

By the way, I do this often, so I'll probably submit more "answers" to this question just to keep track of successful pstops pagespecs. Let me know if this is an inappropriate use of SO.

Wang
  • 2,987
  • 1
  • 18
  • 31
4

A nice, powerful, open-source imposition tool is included in the PoDoFo package: http://podofo.sourceforge.net/ It works for me. Some imposition plans can be found at: http://www.av8n.com/computer/prepress/ PoDoFo can do lots of other stuff, not just imposition.

Another useful imposition tool is Bookbinder (on the quantumelephant site). It has a GUI that appeals to non-experts. It is not as flexible or powerful as PoDoFo, but it can do imposition.

pdftk is more-or-less essential to have, but it will not do imposition.

pdfjam is useless to me, because there are a wide range of valid pdf files that it cannot handle.

I've never been able to get multivalent to work, either.

2

What you want to do is imposition. There are commercial tools to impose PDFs such as ARTS crackerjack and Quite imposing but they are pretty expensive (US$500), require a copy of acrobat professional and are overkill for imposing 2 A4 pages to an A3 sheet.

danio
  • 7,981
  • 5
  • 42
  • 54
1

You can put multiple input pages on one output page using BookletImposer.

And you can change page orders and combine multiple pdf files using PDF Mod.

With these two tools, you can do almost everything you want with pdf files (except editing their content).

1

On the Postscript side, a tool named pstops is able to rearrange pages of a Postscript file in any way you could imagine. I've not heard of such a tool for PDF. But pdf2ps and ps2pdf exist. So a not-so-ideal solution may be a combination of pdf2ps, pstops and ps2pdf.

mouviciel
  • 62,742
  • 10
  • 106
  • 135
  • 2
    After going crazy with NoClassDefFoundError messages, it turns out that the only working JAR I could find was http://www.vrspace.org/sdk/java/multivalent/Multivalent20060102.jar – l0b0 Sep 21 '10 at 23:40
1

I would combine the two A4 pages into one 2-page PDF using pdftk. Then Print to PDF using something like PrimoPDF, and tell it to print to A3 format, two pages per side.

I just tested this printing some slides from PowerPoint. It worked great. I selected A3 as my paper size in PowerPoint, and then chose to print 2 pages per side. Printed to Primo and voila, I have two A4 slides per A3.

Nathan DeWitt
  • 6,321
  • 8
  • 42
  • 65
  • I also thought about such solution, will test if the quality is good enought for comercial magazine print. – Drejc Jan 21 '09 at 14:12
  • The only problem that comes with this solution is a black line between the two joined sheets. Is there a way to remove this later on? – Drejc Jan 21 '09 at 14:57
  • You can get rid of the lines by using adobe reader to print, setting 2 pages per sheet in adobe reader print settings, and setting page size to A3 in the PDF printer settings. – danio Jan 21 '09 at 15:18
  • Found a better solution If you look at my answer, which is the perfect way to do it. Plus it can be scripted and automated which is an additional bonus. – Drejc Jan 22 '09 at 09:59
0

I had a similar problem. I tried Impose but it was giving me an

Exception in thread "main" java.lang.NoClassDefFoundError: tool/pdf/Impose
Caused by: java.lang.ClassNotFoundException: tool.pdf.Impose
(...)
Could not find the main class: tool.pdf.Impose.  Program will exit.

I then tried PDF Snake which isn't free or open source, but has a completely unrestricted 30-day trial version. It worked perfectly, after tweaking the parameters to achieve what I wanted. It's a great tool. I would definitely buy it if it wasn't so expensive! Anyway, I thought I'd leave my 2 cents in case anyone had the same problem I had with Impose.

waldyrious
  • 3,128
  • 4
  • 29
  • 35
  • The error you were getting is probably due to a missing JAR or the way you have triggered impose. Note that you must have java 1.6 installed and java.exe must be in your path. – Drejc Feb 05 '10 at 09:09
  • I do have installed all the following: Java 6 SE Development Kit 6 (v.1.6.0.100), Java 6 (v. 6.0.130), and even Java DB (v. 10.4.1.3). And even though java.exe isn't in my Path system variable, if I type "java" on a console I get the command's usage instructions instead of a "command not found" error. – waldyrious Feb 15 '10 at 22:40
  • 3
    The latest versions don't include the tools package; that's why you get a class not found error. – beerbajay Oct 05 '10 at 00:07
0

look at this

http://sourceforge.net/projects/proposition/

It needs laTex to run, but when it does, works really fine

Regards

kobino
  • 1
  • 1
    As far as I can tell, this is also just wrapper around latex, this time written in ruby. And FWIW, it doesn't work for me, while pdfjam does. YMMV. – dpavlin Apr 05 '11 at 13:44