COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Rotate postscript pages 180 degrees

• Email
• Follow

Greetings.

I need to produce a PDF version of an A5-size book to post online.  The
pages of the book are typeset for A5 paper with LaTeX, so producing a
PostScript or PDF file is not a problem.  However, the front and back
covers of the book, which I want to be included as the first and last
pages of the PDF, were typeset on a single landscape A4 sheet using a
separate application.

I produced a PostScript version of the cover sheet and then used Jos van
Eijndhoven's poster program to convert it to two A5 pages.  My next step
was going to be to convert this document to PDF with ps2pdf, and then to
merge it with the PDF file containing the book pages with pdftk.  However,
the poster program rotated the cover the wrong way before cutting it in
half, resulting in the two cover pages being upside-down.

Is there a command-line tool I can use to rotate the two A5 pages by 180
degrees?  I understand that the rotation can be done by manually editing
the PostScript file, but I'm not a PostScript programmer, and I need to be
able to do this in batch, as I have several such books to produce.

Alternatively, perhaps there is an easier way to go about all this; I would
be grateful for any suggestions.

Regards,
Tristan

--
_
_V.-o  Tristan Miller [en,(fr,de,ia)]  ><  Space is limited
/ |-'  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  <>  In a haiku, so it's hard
(7_\\    http://www.nothingisreal.com/   ><  To finish what you

 0
Reply psychonaut (536) 4/2/2007 2:09:23 AM

See related articles to this posting

On Apr 1, 10:09 pm, Tristan Miller <psychon...@nothingisreal.com>
wrote:
> Greetings.
>
> I need to produce a PDF version of an A5-size book to post online.  The
> pages of the book are typeset for A5 paper with LaTeX, so producing a
> PostScript or PDF file is not a problem.  However, the front and back
> covers of the book, which I want to be included as the first and last
> pages of the PDF, were typeset on a single landscape A4 sheet using a
> separate application.
>
> I produced a PostScript version of the cover sheet and then used Jos van
> Eijndhoven's poster program to convert it to two A5 pages.  My next step
> was going to be to convert this document to PDF with ps2pdf, and then to
> merge it with the PDF file containing the book pages with pdftk.  However,
> the poster program rotated the cover the wrong way before cutting it in
> half, resulting in the two cover pages being upside-down.
>
> Is there a command-line tool I can use to rotate the two A5 pages by 180
> degrees?  I understand that the rotation can be done by manually editing
> the PostScript file, but I'm not a PostScript programmer, and I need to be
> able to do this in batch, as I have several such books to produce.
>
> Alternatively, perhaps there is an easier way to go about all this; I would
> be grateful for any suggestions.
>
> Regards,
> Tristan
>
> --
>    _
>   _V.-o  Tristan Miller [en,(fr,de,ia)]  ><  Space is limited
>  / |-'  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  <>  In a haiku, so it's hard
> (7_\\    http://www.nothingisreal.com/  ><  To finish what you

The commandline tool pstops can do what you need, but be warned -- the
options are extremely cryptic.

If you don't mind working in the PDF domain rather than postscript,
and you don't mind using a .NET Framework tool that I've written, and
you don't mind writing a little XML description of how you want your
pages reformatted -- I have an iTextSharp based tool named pdfimpose
under sporadic development for imposing, resizing, rotating, combining
pages from a PDF.  It gets used something like this, where the purpose
was to place pages from an input PDF 4-up on a larger sheet. (The x
and y numbers are a bit strange because the output PDF from quark had
very strange bounding boxes. But it's good here because it shows you
how it gets used.)

pdfimpose description.xml

description.xml:
<imposition>
<files>
<file name="a">input_layout.pdf</file>
</files>
<output width="1296" height="864">layout_imposed.pdf</output>
<page>
<file name="a" page="1" x="-71.5" y="523.5" rot="-90" />
<file name="a" page="1" x="576.5" y="523.5" rot="-90" />
<file name="a" page="1" x="-71.5" y="955.5" rot="-90" />
<file name="a" page="1" x="576.5" y="955.5" rot="-90" />
</page>
<page>
<file name="a" page="2" x="-71.5" y="523.5" rot="-90" />
<file name="a" page="2" x="576.5" y="523.5" rot="-90" />
<file name="a" page="2" x="-71.5" y="955.5" rot="-90" />
<file name="a" page="2" x="576.5" y="955.5" rot="-90" />
</page>
</imposition>

Finally, there are very good commercial products such as Quite
Imposing that can handle all sorts of manipulations of PDF or
Postscript.


 0

Tristan Miller wrote:
> Greetings.
>
> I need to produce a PDF version of an A5-size book to post online.  The
> pages of the book are typeset for A5 paper with LaTeX, so producing a
> PostScript or PDF file is not a problem.  However, the front and back
> covers of the book, which I want to be included as the first and last
> pages of the PDF, were typeset on a single landscape A4 sheet using a
> separate application.
>
> I produced a PostScript version of the cover sheet and then used Jos van
> Eijndhoven's poster program to convert it to two A5 pages.  My next step
> was going to be to convert this document to PDF with ps2pdf, and then to
> merge it with the PDF file containing the book pages with pdftk.  However,
> the poster program rotated the cover the wrong way before cutting it in
> half, resulting in the two cover pages being upside-down.
>
> Is there a command-line tool I can use to rotate the two A5 pages by 180
> degrees?  I understand that the rotation can be done by manually editing
> the PostScript file, but I'm not a PostScript programmer, and I need to be
> able to do this in batch, as I have several such books to produce.
>
> Alternatively, perhaps there is an easier way to go about all this; I would
> be grateful for any suggestions.
>
> Regards,
> Tristan
>

Tristan,

I usually do this in the LateX document like so:

\documentclass[...]{scrbook}

....
\usepackage{pdfpages}
....
\begin{document}
% include cover from cover.pdf. '{}' is an empty page
\includepdf[pages={1,{}},noautoscale,viewport=470 25 891 621]{cover}
.....
% include back-cover from cover.pdf. '{}' is an empty page
\includepdf[pages={{},1},noautoscale,viewport=25 25 446 621]{cover}
\end{document}

Regards
Hans Georg

 0

On Apr 2, 5:09 am, Tristan Miller <psychon...@nothingisreal.com>
wrote:
> ...
> I produced a PostScript version of the cover sheet and then used Jos van
> Eijndhoven's poster program to convert it to two A5 pages.  My next step
> was going to be to convert this document to PDF with ps2pdf, and then to
> merge it with the PDF file containing the book pages with pdftk.  However,
> the poster program rotated the cover the wrong way before cutting it in
> half, resulting in the two cover pages being upside-down.
> ...

Since you use pdftk anyway, then you can use it to rotate PDF pages.
have this capability.


 0

Greetings.

wrote:
>> I produced a PostScript version of the cover sheet and then used Jos van
>> Eijndhoven's poster program to convert it to two A5 pages.  My next step
>> was going to be to convert this document to PDF with ps2pdf, and then to
>> merge it with the PDF file containing the book pages with pdftk.
>> However, the poster program rotated the cover the wrong way before
>> cutting it in half, resulting in the two cover pages being upside-down.
>
> Since you use pdftk anyway, then you can use it to rotate PDF pages.
> have this capability.

So it does!  I had been using an earlier version (1.12) which doesn't have
this feature (or at least, it's not mentioned in the documentation).

Thanks to everyone else who responded with suggestions, but I think this is
probably the simplest solution in my case.

Regards,
Tristan

--
_
_V.-o  Tristan Miller [en,(fr,de,ia)]  ><  Space is limited
/ |-'  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  <>  In a haiku, so it's hard
(7_\\    http://www.nothingisreal.com/   ><  To finish what you

 0

In article <1175497413.177903.287380@p77g2000hsh.googlegroups.com>,
sags5495@gmail.com says...
> On Apr 2, 5:09 am, Tristan Miller <psychon...@nothingisreal.com>
> wrote:
> > ...
> > I produced a PostScript version of the cover sheet and then used Jos van
> > Eijndhoven's poster program to convert it to two A5 pages.  My next step
> > was going to be to convert this document to PDF with ps2pdf, and then to
> > merge it with the PDF file containing the book pages with pdftk.  However,
> > the poster program rotated the cover the wrong way before cutting it in
> > half, resulting in the two cover pages being upside-down.
> > ...
>
> Since you use pdftk anyway, then you can use it to rotate PDF pages.
> have this capability.
>
Sorry to butt in here guys...

But can this pdftk rotate all pages by 90 degrees ?  I see that it has
an instruction to rotate the first page by 90 degrees... but what about
all pages ?  I scanned in a booklet and all 20 pages need to be rotated
:-(

Tks

--
Howard

 0

In article <MPG.2081a78912a9a1b698a127@news.iol.ie>, fictional@email.com
says...
> sags5495@gmail.com says...
> > On Apr 2, 5:09 am, Tristan Miller <psychon...@nothingisreal.com>
> > wrote:
> > > ...
> > > I produced a PostScript version of the cover sheet and then used Jos van
> > > Eijndhoven's poster program to convert it to two A5 pages.  My next step
> > > was going to be to convert this document to PDF with ps2pdf, and then to
> > > merge it with the PDF file containing the book pages with pdftk.  However,
> > > the poster program rotated the cover the wrong way before cutting it in
> > > half, resulting in the two cover pages being upside-down.
> > > ...
> >
> > Since you use pdftk anyway, then you can use it to rotate PDF pages.
> > have this capability.
> >
> Sorry to butt in here guys...
>
> But can this pdftk rotate all pages by 90 degrees ?  I see that it has
> an instruction to rotate the first page by 90 degrees... but what about
> all pages ?  I scanned in a booklet and all 20 pages need to be rotated
> :-(
>
Ok . . . I tried harder and found the instructions further down the page
..... :-)

This lead me to the following command line:

pdftk abcd.PDF cat 1-endE output efgh.pdf

Does that seem right ?

However it does not work in that it does not find the abcd.pdf file ....
even when I copied the file into the system32 folder .  . .

Any ideas anyone ?

--
Howard

 0

In article <MPG.2081abdc6ae3d5c898a128@news.iol.ie>, Howard9 wrote:
> However it does not work in that it does not find the abcd.pdf file ....
> even when I copied the file into the system32 folder .  . .
>
That would suggest that you're on a Windows system?
PDFTK expects you to give full paths to all the file names, and will
drop the output files into the directory that it's running from (unless you
give it another path at the command line).
What I normally do if I've got a lot of PDFs to process ... Normally
it's because I've been doing a batch of scanning and I've been doing things
wrong. So I've a pile of PDFs in a particular folder. I just copy the PDFTK
executable to that folder, open a command line and navigate to there, then
start to construct a batch file to carry out the operations I want. Without
needing to worry about making long and complex commands even linger and
more complex, that'll give me the output files together with the original
files in the same location. Once I've checked that I've updated things
correctly, then I can tidy up and move onto the next thing I've got to do.
Useful thing for the toolbox is PDFTK.

--
Aidan Karley, FGS
Aberdeen, Scotland
Written at Sun, 08 Apr 2007 22:57 +0100, but posted later.


 0

Greetings.

In article <MPG.2081a78912a9a1b698a127@news.iol.ie>, Howard9 wrote:
>> Since you use pdftk anyway, then you can use it to rotate PDF pages.
>> have this capability.
>>
> Sorry to butt in here guys...
>
> But can this pdftk rotate all pages by 90 degrees ?  I see that it has
> an instruction to rotate the first page by 90 degrees... but what about
> all pages ?  I scanned in a booklet and all 20 pages need to be rotated
> :-(

Since you scanned in the booklet, presumably you have bitmap images of the
pages, and can rotate them using any image editor.  (Use ImageMagick to do
this in batch.)

Regards,
Tristan

--
_
_V.-o  Tristan Miller [en,(fr,de,ia)]  ><  Space is limited
/ |-'  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  <>  In a haiku, so it's hard
(7_\\    http://www.nothingisreal.com/   ><  To finish what you

 0

On Apr 9, 10:37 am, Tristan Miller <psychon...@nothingisreal.com>
wrote:

> Since you scanned in the booklet, presumably you have bitmap images of the
> pages, and can rotate them using any image editor.  (Use ImageMagick to do
> this in batch.)
>

That's perhaps presuming too much. Many scanning packages now save
images in PDF format, not a traditional bitmap format like PNG or TIFF.


 0

In article <1176137571.157696.312950@n76g2000hsh.googlegroups.com>,
rpresser@gmail.com says...
>
> That's perhaps presuming too much. Many scanning packages now save
> images in PDF format, not a traditional bitmap format like PNG or TIFF.
>
yes. Scanned direct to pdf.

--
Howard

 0

In article <VA.00001378.4b4e230c@email.provider.invalid>, name1_name2
@email.provider.invalid says...
>        That would suggest that you're on a Windows system?
>        PDFTK expects you to give full paths to all the file names, and will
> drop the output files into the directory that it's running from (unless you
> give it another path at the command line).
>        What I normally do if I've got a lot of PDFs to process ... Normally
> it's because I've been doing a batch of scanning and I've been doing things
> wrong. So I've a pile of PDFs in a particular folder. I just copy the PDFTK
> executable to that folder, open a command line and navigate to there, then
> start to construct a batch file to carry out the operations I want. Without
> needing to worry about making long and complex commands even linger and
> more complex, that'll give me the output files together with the original
> files in the same location. Once I've checked that I've updated things
> correctly, then I can tidy up and move onto the next thing I've got to do.
>        Useful thing for the toolbox is PDFTK.
>
So are you saying that it is not enough to have the pdf file in the same
folder as the pdftk ?  I need to somehow write the file location into
the command line ?

--
Howard

 0

On Apr 9, 2:53 pm, Howard9 <fictio...@email.com> wrote:

> So are you saying that it is not enough to have the pdf file in the same
> folder as the pdftk ?  I need to somehow write the file location into
> the command line ?

It depends how you're invoking it.

If you're actually at the commandline yourself, and you cd to where
pdftk is, you don't need to type any directories.

If you're invoking it from a program that you're writing, then you
need to either set the current directory before invoking it, or else
include full path names.


 0

In article <1176150451.698785.33600@p77g2000hsh.googlegroups.com>,
rpresser@gmail.com says...
> On Apr 9, 2:53 pm, Howard9 <fictio...@email.com> wrote:
>
> > So are you saying that it is not enough to have the pdf file in the same
> > folder as the pdftk ?  I need to somehow write the file location into
> > the command line ?
>
> It depends how you're invoking it.
>
> If you're actually at the commandline yourself, and you cd to where
> pdftk is, you don't need to type any directories.
>
> If you're invoking it from a program that you're writing, then you
> need to either set the current directory before invoking it, or else
> include full path names.
>
Ah... ok... will try that one :-) thanks.

--
Howard

 0

In article <1176150451.698785.33600@p77g2000hsh.googlegroups.com>,
rpresser@gmail.com says...
> On Apr 9, 2:53 pm, Howard9 <fictio...@email.com> wrote:
>
> > So are you saying that it is not enough to have the pdf file in the same
> > folder as the pdftk ?  I need to somehow write the file location into
> > the command line ?
>
> It depends how you're invoking it.
>
> If you're actually at the commandline yourself, and you cd to where
> pdftk is, you don't need to type any directories.
>
> If you're invoking it from a program that you're writing, then you
> need to either set the current directory before invoking it, or else
> include full path names.
>
BINGO.  Worked perfectly. Many thanks for that help.

The only remaining problem is that the cursor is now horizontal and text
manipulation/search is still unavailable. But I guess that is
inevitable.

Thanks again.

--
Howard

 0

In article <MPG.20849bfd779fd0198a12b@news.iol.ie>, Howard9 wrote:
> So are you saying that it is not enough to have the pdf file in the same
> folder as the pdftk ?
>
That (putting PDFTK into the folder full of PDFs) is what *I* find
to be the *easiest* way *for me*. (Note emphasis.)

> I need to somehow write the file location into
> the command line ?
>
If you're wanting to do things in one run, without having to re-name
files later, not having to move files around later ... yes. But it's
perfectly permissible to shove files "up" a directory if you're going to
run into a naming clash.
Being lazy, I dropped a large PDF into the directory where I keep my
reference copy of PDFTK and called it "man.pdf" ; then running this at the
command line :

D:\progs2\pdftk-1.12> pdftk man.pdf burst output ..\file.%02d.pdf

dropped 60-something files with the appropriate names into the parent
folder (D:\progs2), which was what I wanted.

--
Aidan Karley, FGS
Aberdeen, Scotland
Written at Tue, 10 Apr 2007 17:59 +0100, but posted later.


 0

On Apr 10, 5:53 pm, Aidan Karley <name1_na...@email.provider.invalid>
wrote:

>        If you're wanting to do things in one run, without having to re-name
> files later, not having to move files around later ... yes. But it's
> perfectly permissible to shove files "up" a directory if you're going to
> run into a naming clash.

I usually put useful utilities like pdftk into a "utils" directory on
my LAN, mapped to drive Y:\; and Y:\ is part of the path when I start
a command window.

When I have a utility that has several related EXEs or DLLS together
in one program directory, I throw it into a subdirectory of Y:. It's
fairly quick to type "Y:\xpdf\pdftops input.pdf output.ps"


 0

Howard9 wrote:
> sags5495@gmail.com says...
>
>>On Apr 2, 5:09 am, Tristan Miller <psychon...@nothingisreal.com>
>>wrote:
>>
>>>...
>>>I produced a PostScript version of the cover sheet and then used Jos van
>>>Eijndhoven's poster program to convert it to two A5 pages.  My next step
>>>was going to be to convert this document to PDF with ps2pdf, and then to
>>>merge it with the PDF file containing the book pages with pdftk.  However,
>>>the poster program rotated the cover the wrong way before cutting it in
>>>half, resulting in the two cover pages being upside-down.
>>>...
>>
>>Since you use pdftk anyway, then you can use it to rotate PDF pages.
>>have this capability.
>>
>
> Sorry to butt in here guys...
>
> But can this pdftk rotate all pages by 90 degrees ?  I see that it has
> an instruction to rotate the first page by 90 degrees... but what about
> all pages ?  I scanned in a booklet and all 20 pages need to be rotated
> :-(
>
> Tks
>
Divert showpage or use my Gonzo utilities.

--
Many thanks,

Don Lancaster                          voice phone: (928)428-4073
Synergetics   3860 West First Street   Box 809 Thatcher, AZ 85552

Please visit my GURU's LAIR web site at http://www.tinaja.com

 0