PostScript is a programming language, so you can do a lot with it. What you need to do is override the page size request action. The page size and content are separated in PostScript, so you need to do 2 things:
1) Change the media request from landscape to portrait
2) rotate page content
The easiest way to do this is to override the setpagedevice statement. Here is an example:
/oldsetpagedevice /setpagedevice load def %% copy original definition /setpagedevice { dup /PageSize known { %% Do we have a page size redefinition ? dup /PageSize get %% get the array if so aload pop %% get elements remove array copy gt { %% is width > height ? dup /PageSize get aload %% get size array, put content on stack 3 1 roll %% roll stack to put array at back exch %% swap width and height 3 -1 roll %% bring array back to front of stack astore %% put swapped elements into array /PageSize exch %% put key on stack and swap with value 2 index %% copy the original dict 3 1 roll %% move dict to back of stack put %% put new page size array in dict 90 rotate %% rotate content 90 degrees anti-clockwise } if } if oldsetpagedevice %% call the original definition } bind def
This checks the configuration changes to see if the page is resized if it gets a new size, and looks to see if it will have a width> height (a simple definition of the landscape). If true, then it modifies the query by replacing the width and height, and then rotates the contents of the page 90 degrees.
You can use this with Ghostscript by placing the above content in a file (e.g. prolog.ps) and then running this file before your own task:
gs ...... prolog.ps job.ps
I tried this, but not with the landscape file, since I did not have it. Also note that you can create a PostScript program that defeats this.
source share