Re: PostScript to PDF and Duplex/Tumble

"RITTER, Philippe" <[email protected]> Mon, 6 Jun 2016 13:08:16 +0000
Newsgroups gmane.comp.printing.ghostscript.devel
Message-ID <[email protected]>
Hi Ken,

No problem, thank you for taking time to answering for my problem.

I can't just make the orientation when printing to my printer, because I want some page to printed this way, and some other on the other way.

I have also tried to rotate with your sample. It works in Ghostview, but not when I try to convert it with gs to PDF. Same for /Orientation, doesn't work either. It was my typo error, in my postscript it was correct.

I will try something else. Thank you again for your help

Kind regards
Philippe RITTER

-----Message d'origine-----
De : Ken Sharp [mailto:[email protected]] 
Envoyé : lundi 6 juin 2016 10:54
À : RITTER, Philippe
Cc : '[email protected]'
Objet : Re: [gs-devel] PostScript to PDF and Duplex/Tumble

Hi Philippe,

Sorry you've had to wait for a reply, we've had a company staff meeting and 
so we've all been away from our desks.


At 17:02 01/06/2016 +0000, RITTER, Philippe wrote:

>I'm using Ghostscript for converting a Postscript generated file to PDF. 
>It is working fine, except if in the postscript file there is this command :
><</Duplex true
>/Tumble true
>/EndOfSet false
> >>setpagedevice
>
>The Tumble is not recognized. I think it is maybe by design, because 
>Duplex is not possible in PDF.

None of those requests will have any effect with the pdfwrite device. 
Device-specific requests are ignored by devices which don't implement them; 
since Tumble is only relevant with Duplex, any device which does not 
implement Duplex will also not implement Tumble.

Because the PDF specification doesn't allow for print features like these, 
they cannot be embedded in the PDF file and so the pdfwrite device does 
indeed ignore them.


>  But as my document is full duplex, and printed on a Canon Inkjet system, 
> I want that in my PDF some pages are turned 180° for printing like Duplex 
> Tumbled.

Can you not simply specify Duplex and Tumble when you print the PDF file to 
your printer ?


>I have also tried to put /orientation 2, but it doesn't work either.

All the entries in the page device dictionary are *requests*, which a 
device may honour or ignore as it appropriate. Note that the correct key 
should be /Orientation, not /orientation, PostScript is case-sensitive.


>Can someone help me or give me some information how I could achieve this ? 
>Maybe in the Postscript file directly, or in command line in gs ?

You can rotate the pages if you really want to do so by providing a 
BeginPage procedure which does what you want. This procedure is called at 
the start of every page and is permitted to do operations that affect the 
CTM after the page is established but before the program is executed.

This code:

<<
/BeginPage
{               %% starts with number of showpages so far on the stack
   2 mod 0 eq    %% if <page> mod 2 is 0 then its an even page
   {             %% so we rotate it
     currentpagedevice /PageSize get
     aload pop -1 mul
     translate
     180 rotate
   } if
}
 >> setpagedevice

Will rotate even numbered pages by 180 degrees.


                 Regards,


                     Ken Sharp