PDF Manipulation: "2-Up" page layout

6

2

I have a PDF (generated by PowerPoint) containing 8.5×5.5 inch portrait pages.

I need to convert it to 8.5×11 inch landscape pages where each landscape page contains two copies of the original (smaller) portrait page side-by-side.

In ASCII art:

 Original  |    Desired
           | 
  |---|    |  |---| |---|
  | 1 |    |  | 1 | | 1 |
  | 1 |    |  | 1 | | 1 |
  |---|    |  |---| |---|
           |
  |---|    |  |---| |---|
  | 2 |    |  | 2 | | 2 |
  | 2 |    |  | 2 | | 2 |
  |---|    |  |---| |---|

Is there any free way to do this, or will I need to do it in C#?

SLaks

Posted 2010-01-15T02:33:26.557

Reputation: 7 596

Answers

2

"Print" it using pdfcreator (open source virtual printer driver).

//edit: One more option is using pdftk (http://www.accesspdf.com/pdftk/), but I haven't tested it myself.

Maciek Sawicki

Posted 2010-01-15T02:33:26.557

Reputation: 1 072

I don't see how to duplicate pages in PDF creator (See my ASCII art) – SLaks – 2010-01-15T02:47:56.283

Now I tested it. In pdf print dialog I chose to copies and printing multiple pages per sheet.

Unfortunately it groups pages instead of putting to copies on thesame page :(. I'm sorry for non tested answer. – Maciek Sawicki – 2010-01-15T02:58:00.823

If I play with collation, it might work. Where did you specify multiple pages per sheet? – SLaks – 2010-01-15T03:01:02.613

In print dialog in Acrobat Reader, but unfortunately collate option looks broken for printing multiple pages per sheet. I also set double size in printer properties (properties button print dialog in Acrobat Reader).

How about copping slides in PowerPoint? – Maciek Sawicki – 2010-01-15T03:05:44.697

1The slides use multiple masters pages with different formatting. I tried writing a macro to copy them, but I couldn't make it handle the formatting correctly. – SLaks – 2010-01-15T03:10:51.770

4

OK, you solved it by having access to the source file of your PDFs, the Powerpoint file. What could you do if you want to achieve the same thing without access to the sources?

Let me give this a shot. I'll be using...

  1. Ghostscript for placing and shifting the input PDF pages onto the new media size;
  2. pdftk to overlay two different PDF pages onto one.

First step: Ghostscript to place images on larger media

Here is what we want to achieve with the help of Ghostscript in this step:

+-----------+-----------------------+
| Original  |  Ghostscript-output   |
+===========+=======================+
|  +---+    |  +---+---+  (right    |
|  | p |    |  | p |   |   half     |
|  | 1 |    |  | 1 |   |   of sheet |
|  +---+    |  +---+---+   empty)   |
|           |                       |
|  +---+    |  +---+---+  (left     |
|  | p |    |  |   | p |   half     |
|  | 2 |    |  |   | 2 |   of sheet |
|  +---+    |  +---+---+   empty)   |
+-----------+-----------------------+

This is the first command to use:

gswin32c.exe ^
 -o left-side-outputs.pdf ^
 -sDEVICE=pdfwrite ^
 -g7920x6120 ^
 -dPDFSETTINGS=/prepress ^
 -c "<</PageOffset [0 0]>>setpagedevice" ^
 -f powerpoint.pdf

I shifted all page images by... nothing, but placed them on a bigger sheet. I'm too lazy to type and explain all the options needed to select the odd page numbers only, so for now I simply do this for all pages. -- So this is what we did achieve for now:

+-----------------------+
|  Ghostscript-output   |
+=======================+
|  +---+---+  (right    |
|  | p |   |   half     |
|  | 1 |   |   of sheet |
|  +---+---+   empty)   |
|                       |
|  +---+---+  (right    |
|  | p |   |   half     |
|  | 2 |   |   of sheet |
|  +---+---+   empty)   |
|                       |
|  +---+---+  (right    |
|  | p |   |   half     |
|  | 3 |   |   of sheet |
|  +---+---+   empty)   |
|  .........            |
+-----------------------+
 (left-side-outputs.pdf)

Now putting all images to the right:

gswin32c.exe ^
 -o right-side-outputs.pdf ^
 -sDEVICE=pdfwrite ^
 -g7920x6120 ^
 -dPDFSETTINGS=/prepress ^
 -c "<</PageOffset [396 0]>>setpagedevice" ^
 -f powerpoint.pdf

This is what we achieved with the second command:

+-----------------------+
|  Ghostscript-output   |
+=======================+
|  +---+---+  (left     |
|  |   | p |   half     |
|  |   | 1 |   of sheet |
|  +---+---+   empty)   |
|                       |
|  +---+---+  (left     |
|  |   | p |   half     |
|  |   | 2 |   of sheet |
|  +---+---+   empty)   |
|                       |
|  +---+---+  (left     |
|  |   | p |   half     |
|  |   | 3 |   of sheet |
|  +---+---+   empty)   |
|  .........            |
+-----------------------+
 (right-side-outputs.pdf)

Second step: use pdftk.exe to overlay pairs of pages.

In case you haven't installed it yet, download it from here. It doesn't require a real installation. It's an .exe file which runs from every location. We want to make the result look like this:

+---------------------+-------------+
| pdftk input         | pdftk output|
+=====================+=============+
| +---+---+ (right    | +---+---+   |
| | p |   |  half     | | p | p |   |
| | 1 |   |  of sheet | | 1 | 2 |   |
| +---+---+  empty)   | +---+---+   |
|                     |             |
| +---+---+ (left     |             |
| |   | p |  half     |             |
| |   | 2 |  of sheet |             |
| +---+---+  empty)   |             |
+---------------------+-------------+

We will use these commands:

pdftk.exe ^
   A=left-side-outputs.pdf ^
   B=right-side-outputs.pdf ^
   cat A1 B2  ^
   output 2up-powerpoint-page-1.pdf ^
   verbose

pdftk.exe ^
   A=left-side-outputs.pdf ^
   B=right-side-outputs.pdf ^
   cat A3 B4  ^
   output 2up-powerpoint-page-2.pdf ^
   verbose

OK, so far we only created the first two double-up pages... However, I now want to concatenate these two double-pages into a single file:

pdftk.exe ^
  A=2up-powerpoint-page-1.pdf ^
  B=2up-powerpoint-page-2.pdf ^
  cat A B ^
  output 2up-powerpoint-all.pdf

You should now have enough inspiration to process the remaining pages... if you are super-ambitious, you'll even script that with one single commandline, using two nested for /l ... loops ;-)

Kurt Pfeifle

Posted 2010-01-15T02:33:26.557

Reputation: 10 024

1

I solved this by generating a second PowerPoint presentation with two copies of each slide, saving it to PDF, and printing the PDF with two pages per sheet.

SLaks

Posted 2010-01-15T02:33:26.557

Reputation: 7 596

0

This can also be done using Python with PyPDF2 https://pythonhosted.org/PyPDF2/index.html

You can see some example code in another post: https://superuser.com/a/1508283/590044

Loren

Posted 2010-01-15T02:33:26.557

Reputation: 101