[bug-gs] Mirroring a postscript file.

Ray Johnston ray.johnston@artifex.com
Thu, 31 Jul 2003 07:46:57 -0700


You are close to a solution, but the 'real' method involves the
use of a feature of the 'setpagedevice' parameters, something I
would hardly expect someone new to PostScript to know about.

This is documented in the PostScript Language Reference Manual
and is fully functional in Ghostscript.

The /Install procedure of the setpagedevice parameter dict is
the key. The transformation matrix set by this Install proc
becomes the 'default' CTM for operators like 'initgraphics'
so general PS will work (not just those like EPS files that
are prohibited from using 'initgraphics').

The prefix file that you need is:

   /Install {
     currentpagedevice /PageSize get 0 get % get page width
     0 translate -1 1 scale % translate to (maxX,0) and mirror
 >> setpagedevice
% ---- end mirroring prefix

The above translate to the Page width, so will work with any
size page (unlike the example that you had that used an
arbitrary '650' translation. BTW, I tested this and it works.

Good luck!

Ray Johnston
Artifex Software Inc.
Joao S. O. Bueno wrote:

> Hi there...
> I am in need to mirror some postscript files I have, and
> I wonder if GS is not able to do that as it is.
> I know something about " basic" postscript, but nothing
> about deeper PS - I am not sure about how dictionaries work for instance.
> I found just one reference on the web about making these mirros I want, 
> but the solution involved first turning my PS files into EPS, nd them 
> embedding them in a little PS code. But although the files do open fine 
> in gs, ps2epsi would break on them. (If someone cares, they are 
> openoffice generated files).
> A solution of the kind:
> %!PS
> -1 1 scale
> -650 0 translate
> (original_file.ps) run
> __
> that workd on more complex files would be enough for me. thanx.
>     JS
>     -><-
> _______________________________________________
> bug-gs mailing list
> bug-gs@ghostscript.com
> http://www.ghostscript.com/mailman/listinfo/bug-gs