PDF Manipulation: "2-Up" page layout
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#?
"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.
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...
- Ghostscript for placing and shifting the input PDF pages onto the new media size;
- 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 ;-)
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.