How can I combine two PDF pages show up on the same page?

80,834

Solution 1

Check out this answer that uses Multivalent to impose PDF pages

Solution 2

This is a summary of the tools I found for PDF (I wanted to find the equivalent of psup and psbook)

  • Create booklets: pdfbook, pdf-tools (command: pdfbklt)
  • Merge PDF files: pdfmerge, pdfjam (command: pdfjoin)
  • Rotate pages: pdfjam (command: pdf90)
  • Multiple pages per sheet: pdfjam (command: pdfnup)
  • Create posters (multiple sheets per page): pdfposter

From my package manager:

Create an A6 booklet:

pdfbook -2 -p a5 infile.pdf outfile.pdf

pdf-tools contains:

  • pdfbklt: create booklets
  • pdfrevert: Removes one layer of changes to a PDF file, trying to maximise the size of the output file (to account for linearised PDF).
  • pdfstamp: Adds the given string to the infile .pdf file at the given location, font and size.

There is also multivalent: http://multivalent.sourceforge.net/Tools/index.html

Solution 3

On Linux, you can convert the PDF files to Postscript and use psnup. The exact way to invoke it depends on exactly how you want the pages to be put together, whether you want them rotated, what paper size(s) you want to use, etc. but it'll be something like this:

pdf2ps infile.pdf infile.ps
psnup -2 infile.ps outfile.ps
ps2pdf outfile.ps outfile.pdf

Depending on what tools you have available, you might have a more efficient way to do this - psnup is certainly not the only way, but it's a relatively well-known program (on Linux anyway).

Solution 4

If you use Linux, you can use BookletImposer for putting multiple PDF pages on one single page.

For Ubuntu users, this tool is available at Ubuntu Software Center.

Solution 5

In answer to your question, you'll need a PDF 'Imposition' tool, which is a fancy way of saying a tool that arranges PDF page images onto a particular array to create a NEW single PDF page. Imagine it's something like typesetting a newspaper. You define an array of slots a certain number of columns wide, by a certain number of rows deep, on a page of a certain fixed dimensions (in cm). Then you fill those empty slots top to bottom, left to right with pages from a pdf source-file. In the case of the OP, they want to create a single page, composed of two 8.5x11 pages arranged in a 1x2 array (1 column, 2 rows). Their pages will be dropped into the array in the following order: 1,2. So you are dropping the first page (page 1 of the pdf) into the first slot of your array (Column 1, row 1), and you are dropping the second page (page 2) into the second slot (Column 1, row 2).

How to use the tool to make this happen: Download the old version of Multivalent. Note the author removed the good tool classes from the latest edition without explanation, so you have to use an older one. Here's a working link as of 02/12: http://code.google.com/p/pdfsizeopt/downloads/detail?name=Multivalent20060102.jar For simplicity, I renamed the jar file to m.jar. It sort of goes without saying that you need to install JRE for this to work, but I'll put it out there. Add m.jar to your Java Class Path Environment variables (for scripting) or run the command line syntax with the -cp option and the relative path (shown below). Note, I ran it FROM the command-line at the install directory in my example below. Provide an absolute path from root otherwise (like c:\1\bin\m.jar).

Here is an example that will accomplish exactly what OP posted about: C:\1\bin>java -cp m.jar tool.pdf.Impose -dim 1x2 -verbose -papersize "21.59x55.88cm" -layout "1,2" yourfilename.pdf

Note, the -dim option creates the array in Columns x Rows. The -papersize is specified in centimeters here, but if you need inches, just multiply inches by 2.54 to get cm. The -layout option gives you the order you want to fill the empty slots in your array, filling from top to bottom and left to right. In this case, we want page one of the pdf on top and page two on the bottom, so our argument is "1,2". The final argument is your actual source file. The tool will output a file called yourfilename-up.pdf when you are done.

Hope that helps.

-Matt Zweil

Share:
80,834
Boris Gorelik
Author by

Boris Gorelik

Updated on August 08, 2020

Comments

  • Boris Gorelik
    Boris Gorelik almost 4 years

    I am looking for a free tool that allows re-arranging pages of a PDF document and combining multiple pages per sheet. The first part (re-arranging) is easily solved by many tools (I use PyPDF).

    The problem is with the second requirement: to combine two (or more) pages into single page. For example, take two pages (A and B), rotate them, scale and combine into a single page like this

    ------       ------            ------
    |     |      |      |          |     |
    |  A  |      |  B   |          | a   |
    |     |      |      |          |     |
    |     |      |      |  --->    ------
    |     |      |      |          |     |        
    |     |      |      |          | b   |        
    |     |      |      |          |     |        
    ------       ------            ------
    

    The solution needs to work on Linux and preferably on Windows too. I'm looking for either console application or library with Python or Perl bindings.

    Edit there is pdfnup library that is supposed to perform exactly this kind of transformation, and is cross-platform, however I cannot use it due to a bug similar to this.