Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Does anyone know of a good way to split a pdf's pages down the middle into two new pages?

To be clear, I'm not trying to split out already existing pages from a pdf; I am trying to create two new pages from an existing single page.

share|improve this question
    
why do you want to do this? getting smaller pages? –  akira Jan 19 '11 at 6:19
    
Well MS Office is not a freeware, but if you have MS Office 2007, then you could just save documents as PDF files and do as you please... –  Owen Jan 19 '11 at 6:49
    
See also stackoverflow.com/q/13345593/321973 –  Tobias Kienzler Dec 1 '14 at 10:40

4 Answers 4

up vote 22 down vote accepted

Try BRISS.

alt text

It lets you split each page into as many subpages as you want by defining regions with a GUI. It groups all similar pages into groups for you, so you can define regions for that group once.

It's cross-platform, free, and open-source.

share|improve this answer
1  
Brilliant. Thank you. –  YGA Jan 24 '11 at 8:27
    
It seems this increases file size (times "number of output pages per input page"), because it uses the original page content and a cropbox for each cropped page. If you need small file size, you can print the output file to PS and then convert to PDF, but you might lose quality then (for example, due to bitmap fonts). –  tanius Mar 17 at 13:44

You can solve this with the help of Ghostscript. pdftk alone cannot do that (to the best of my knowledge). I'll give you the commandline steps to do this manually. It will be easy to script this as a procedure, also with different parameters for page sizes and page numbers. But you said that you can do that yourself ;-)

How to solve this with the help of Ghostscript...

...and for the fun of it, I've recently done it not with an input file featuring "double-up" pages, but one with "treble-ups". You can read the answer for this case in this other response.

Your case is even simpler. You seem to have something similar to this:

+------------+------------+   ^
|            |            |   |
|      1     |      2     |   |
|            |            | 595 pt
|            |            |   |
|            |            |   |
|            |            |   |
+------------+------------+   v
             ^
            fold
             v
+------------+------------+   ^
|            |            |   |
|      3     |      4     |   |
|            |            | 595 pt
|            |            |   |
|            |            |   |
|            |            |   |
+------------+------------+   v
<---------- 842 pt -------->

You want to create 1 PDF with 4 pages, each of which has the size of 421 pt x 595 pt.

First Step

Let's first extract the left sections from each of the input pages:

gs \
    -o left-sections.pdf \
    -sDEVICE=pdfwrite \
    -g4210x5950 \
    -c "<</PageOffset [0 0]>> setpagedevice" \
    -f double-page-input.pdf

What did these parameters do?

First, know that in PDF 1 inch == 72 points. Then the rest is:

  • -o ...............: Names output file. Implicitely also uses -dBATCH -dNOPAUSE -dSAFER.
  • -sDEVICE=pdfwrite : we want PDF as output format.
  • -g................: sets output media size in pixels. pdfwrite's default resolution is 720 dpi. Hence multiply by 10 to get a match for PageOffset.
  • -c "..............: asks Ghostscript to process the given PostScript code snippet just before the main input file (which needs to follow with -f).
  • <</PageOffset ....: sets shifting of page image on the medium. (Of course, for left pages the shift by [0 0] has no real effect.)
  • -f ...............: process this input file.

Which result did the last command achieve?

This one:

Output file: left-sections.pdf, page 1
+------------+  ^
|            |  |
|     1      |  |
|            |595 pt
|            |  |
|            |  |
|            |  |
+------------+  v

Output file: left-sections.pdf, page 2
+------------+  ^
|            |  |
|     3      |  |
|            |595 pt
|            |  |
|            |  |
|            |  |
+------------+  v
<-- 421 pt -->

Second Step

Next, the right sections:

gs \      
    -o right-sections.pdf \
    -sDEVICE=pdfwrite \
    -g4210x5950 \
    -c "<</PageOffset [-421 0]>> setpagedevice" \
    -f double-page-input.pdf

Result:

Output file: right-sections.pdf, page 1
+------------+  ^
|            |  |
|     2      |  |
|            |595 pt
|            |  |
|            |  |
|            |  |
+------------+  v

Output file: right-sections.pdf, page 2
+------------+  ^
|            |  |
|     4      |  |
|            |595 pt
|            |  |
|            |  |
|            |  |
+------------+  v
<-- 421 pt -->

Last Step

Now we combine the pages into one file. We could do that with ghostscript as well, but we'll use pdftk instead, because it's faster for this job:

pdftk \
  A=right-sections.pdf \
  B=left-sections.pdf \
  shuffle A B \
  output single-pages-output.pdf
  verbose

Done. Here is the desired result. 4 different pages, sized 421x595 pt.

Result:

+------------+ +------------+ +------------+ +------------+   ^
|            | |            | |            | |            |   |
|     1      | |     2      | |     3      | |     4      |   |
|            | |            | |            | |            | 595 pt
|            | |            | |            | |            |   |
|            | |            | |            | |            |   |
|            | |            | |            | |            |   |
+------------+ +------------+ +------------+ +------------+   v
<-- 421 pt --> <-- 421 pt --> <-- 421 pt --> <-- 421 pt -->
share|improve this answer
3  
Pretty! You should really use this in every answer if you want to keep getting upvotes for free! –  Ivo Flipse Mar 1 '11 at 22:29
2  
The second step only worked for me when I used a negative offset: "<</PageOffset [-421 0]>> setpagedevice". I guess it depends on the orientation of the original file. Excellent answer nonetheless. :) –  moraes Mar 31 '13 at 22:38
1  
To me the second step also worked with the minus sign –  Rafareino Aug 14 '14 at 22:20

To expand upon @Kurt's answer (since I don't have enough reputation points to comment) first make sure the dimensions you use is not based on the Crop Box dimensions if they are different from the Media Box dimensions. The output size is based on Media Box dimensions, but the offset seems to use the Crop Box dimensions.

For a gatefold page that had a 20.0833 x 13.833 media box and a 19.25 x 13.0 crop box which was the same as the trim box in my document, to split it into two pages on Ubuntu, for the left side:

gs -o left.pdf -sDEVICE=pdfwrite -g7230x9960 -c "<</PageOffset [0 0]>> setpagedevice" -f gatefold.pdf

The right side:

gs -o right.pdf -sDEVICE=pdfwrite -g7230x9960 -c "<</PageOffset [-693 0]>> setpagedevice" -f gatefold.pdf

And then stitched them with pdftk left.pdf right.pdf output final.pdf.

An alternative would be to set the crop box to the same as the media box; then the offset would be -723. But then the crop would have to be reset to trim in order for the pages to appear seamless. Otherwise, set media to crop.

share|improve this answer
    
Note, after splitting the pages with these command options, the media boxes do not change. Only the crop changes. If you split one page into multiple pages, the new pages keep the media box dimensions from the old page. Need sed to modify the media box dimensions. Though don't know how to set media box to crop without including numbers in the command. –  motorbaby Jul 27 at 21:49
    
Oops. I mean the new pages keep the crop box dimensions from the old page. –  motorbaby Jul 28 at 19:08
    
Found a bug with Acrobat PDFs. Visually, cropBox dimensions can be seen in Set Page Boxes in Acrobat. But cropBox dimensions after using Ghostscript to divide the gatefold kept the old page dimensions on another level. This could be seen in Preflight Analyze info in Acrobat. After adjusting the crop in Acrobat on the right side of the left page temporarily to an arbitrary number and then returning it to 0, the other box dimensions (bleed, art, and trim) also adjusted. This fixed the problem where the cropBox data still showed the old page dimensions. The right page was a little different. –  motorbaby Jul 28 at 20:08

If you are comfortable with some programming or prepared to give it a go, then you could:

Using the iText library you can to manipulate PDFs.
This can also be used for converting, splitting, encrypting etc.

share|improve this answer
    
@mic84 - an unnecessary edit on a very old post. And a -1 for my troubles. Thanks a lot! –  misterjaytee Jul 25 at 10:12
    
In the black bar at the top of the page you will see 'Review', this is where your answer was placed for review, edit, etc. These are current items, i do not go page by page The edit was only done to make it easier to read. As for the - minus i could have clicked it buy mistake. Please click review and help away, enjoy the test answers and questions. –  mic84 Jul 26 at 7:29
    
@mic84 - fair enough. I already do reviews from time to time; odd how such old posts come up for review though. –  misterjaytee Jul 26 at 18:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.