11
10
How can I convert a PDF with 2 sides per page to 1 side per page?
11
10
How can I convert a PDF with 2 sides per page to 1 side per page?
23
OK, the problem was already solved with the help of Acrobat (full version, not Reader). But what to do if you don't have access to Acrobat? Could this be done with Ghostscript and pdftk as well?
...and for the fun of it, let's not use an input file with "double-up" pages, but one with "treble-up". Actually, I received one such PDF today by email. It was a flyer, folded in Leporello's Scheme. The sheet size was A4 landscape (842pt x 595pt), and it was folded and layed-out like this:
Front side to be printed, page 1 of PDF
+--------+--------+--------+ ^
| | | | |
| 5 | 6 | 1 | |
| | | | 595 pt
| | | | |
| | | | |
| | | | |
+--------+--------+--------+ v
^ ^
fold fold
v v
+--------+--------+--------+ ^
| | | | |
| 2 | 3 | 4 | |
| | | | 595 pt
| | | | |
| | | | |
| | | | |
+--------+--------+--------+ v
Back side to be printed, page 2 of PDF
<---------- 842 pt -------->
I want to create 1 PDF with 6 pages, each of which has the unusual size of 280.67pt x 595 pt.
Let's first extract the left sections from each of the input pages:
gswin32c.exe ^
-o left-sections.pdf ^
-sDEVICE=pdfwrite ^
-g2807x5950 ^
-c "<</PageOffset [0 0]>> setpagedevice" ^
-f myflyer.pdf
What did these parameters do?
-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
+--------+ ^
| | |
| 5 | |
| |595 pt
| | |
| | |
| | |
+--------+ v
Output file: left-sections.pdf, page 2
+--------+ ^
| | |
| 2 | |
| |595 pt
| | |
| | |
| | |
+--------+ v
< 280 pt >
Now let's do the analogous thing for the center sections:
gswin32c.exe ^
-o center-sections.pdf ^
-sDEVICE=pdfwrite ^
-g2807x5950 ^
-c "<</PageOffset [280.67 0]>> setpagedevice" ^
-f myflyer.pdf
Result:
Output file: center-sections.pdf, page 1
+--------+ ^
| | |
| 6 | |
| |595 pt
| | |
| | |
| | |
+--------+ v
Output file: center-sections.pdf, page 2
+--------+ ^
| | |
| 3 | |
| |595 pt
| | |
| | |
| | |
+--------+ v
< 280 pt >
Last, the right sections:
gswin32c.exe ^
-o right-sections.pdf ^
-sDEVICE=pdfwrite ^
-g2807x5950 ^
-c "<</PageOffset [561.34 0]>> setpagedevice" ^
-f myflyer.pdf
Result:
Output file: right-sections.pdf, page 1
+--------+ ^
| | |
| 1 | |
| |595 pt
| | |
| | |
| | |
+--------+ v
Output file: right-sections.pdf, page 2
+--------+ ^
| | |
| 4 | |
| |595 pt
| | |
| | |
| | |
+--------+ v
< 280 pt >
Now we combine the pages into one file:
pdftk.exe ^
A=right-sections.pdf ^
B=center-sections.pdf ^
C=left-sections.pdf ^
cat A1 B2 C2 A2 B1 C1 ^
output single-files-input.pdf
verbose
Done. Here is the desired result. 6 different pages, sized 280.67x595.
Result:
+--------+ +--------+ +--------+ +--------+ +--------+ +--------+ ^
| | | | | | | | | | | | |
| 1 | | 2 | | 3 | | 4 | | 5 | | 6 | |
| | | | | | | | | | | | 595 pt
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| | | | | | | | | | | | |
+--------+ +--------+ +--------+ +--------+ +--------+ +--------+ v
< 280 pt > < 280 pt > < 280 pt > < 280 pt > < 280 pt > < 280 pt >
You can use Python for larger PDFs:
f = open("order.dat","w") for i in [a+1 for a in xrange(63)]: f.write("A{0} B{0} ".format(i)) f.close() This will create a file order.dat with "A1 B1 A2 B2 ... A63 B63". You can then copy-paste it to pdftk. – Suuuehgi – 2015-06-07T11:56:32.390
1Holy crap, awesome art right here! – Ivo Flipse – 2011-03-01T22:28:37.120
This worked well for me, but I had to set the PageOffset to a negative number in order to get the other sections. – jonchang – 2013-01-08T19:09:03.307
3
@peims, thanks. Here's the step-by-step version of your method. I tried it on a file I wanted to convert for my Kindle DX, and it works perfectly:
Next, use pdftk.exe (from http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) to interleave the results into a single file. Copy "pdftk.exe", "left.pdf" and "right.pdf" to to "D:\", and execute:
Note: if you copy the files to "C:\", it won't work under Win 7 due to security permissions. If you don't have a D:\, then create a directory "C:\x" to complete the operation.
These results would normally be good enough. However, there's two more optional steps to improve the output.
3
Just had the same problem. I stumbled upon briss, an open source java GUI tool for separating and cropping pdf pages:
http://sourceforge.net/projects/briss/
It worked very well for me, on Linux, even though the user interface isn't completely trivial. It even worked with a pdf with some differently sized pages!
2
I use the following script to process scanned books on Mac and Linux. This can get quite memory intensive.
#!/bin/bash
#
# This script processes scanned books. After scanning the books have been cropped with
# Preview. This does kind of a "soft crop" that we need to make a bit "harder".
#
# The second step is to take each page of the PDF and split this into two two pages,
# because each page of the scanned document actually contains two pages of the book.
#
#
FILE=`mktemp`.pdf
FILE2=`mktemp`.pdf
FILE3=`mktemp`.pdf
echo "Making a temporary copy of the input file."
cp $1 $FILE
#
# Start cropping
#
echo "Cropping the PDF"
# The first regex removes all boxes but CropBox. The second regex renames the CropBox as MediaBox
perl -pi.bak -e 's/\/(Media|Bleed|Art|Trim)Box[\n\l\f\s]*\[(.+?)\]//msg;' $FILE
perl -pi.bak -e 's/CropBox/MediaBox/g;' $FILE
echo "Validating the PDF"
#Run PDFTK to ensure that the file is OK
cat $FILE | pdftk - output $FILE2
#
# Done cropping, start splitting the pages
#
echo "Splitting the pages in two and changing to 200 dpi with imagemagick. Output goes to $FILE3"
convert -density 200 $FILE2 -crop 50%x0 +repage $FILE3
#
# Done spliting, copy the result in a new file
#
mv $FILE3 $1.pages.pdf
2
You could duplicate the document, then crop the pages so that only the even page numbers show in one file and only the odd page numbers in the other. Then split the files into single pages and recombine to make one document with single sides to a page...
You can do this using a number of methods, for example:
1
Thanks for a great reference. I was in a similar issue but wanted to share what worked for me.
I had a landscape oriented tabloid pdf with portrait oriented text only the left side. Essentially 2-up tabloid missing any content on the right side of the page. Similar starting point, but tabloid is 792 × 1224 (Portrait), 1124 x 792 (Landscape) and the point definition for the 1/2 tabloid i needed was 612 x 792 points.
"C:\Program Files\gs\gs9.10\bin\gswin64c.exe" -o left2.pdf -sDEVICE=pdfwrite -g6120x7920 -c "<</PageOffset [0 0]>> setpagedevice" -f "RFP.pdf"
Got me the content I needed into 8.5 x 11 portrait, much more readable.
0
What I understand is that a PDF file showing two pages(side by side on one sheet) needs to be converted to one page per sheet resulting in two sheets of PDF file. In other words if there are total thirty pages on 15 sheets, we need to convert the PDF file to a PDF file of thirty sheets each showing one page. If this the problem I have used Adobe acrobat XI PRO "extract page tool" by specifying page numbers from 1 to 30
Possible duplicate of How can I split a PDF's pages down the middle?
– Skippy le Grand Gourou – 2016-02-10T14:38:21.407@SkippyleGrandGourou I don't see how that question is related. Aren't the questions trying to do two different things with pages? – Ben N – 2016-02-12T17:21:58.807
@BenN : Both questions ask how to "create two new pages from an existing single page", to quote the other one. The most voted answer is almost a copypasta. – Skippy le Grand Gourou – 2016-02-12T21:00:18.837
This is absolutely crazy! Is there no way to change page settings in a PDF to be one-sided instead of two-sided? – Nathan Fellman – 2010-08-31T09:23:24.343
@Nathan Fellman: Crazy, yes. But crazy things sometimes give you most of the fun ;-) – Kurt Pfeifle – 2010-09-15T21:07:08.833