[comp.lang.postscript] Inversion of text and graphics

cld@kd4nc.UUCP (Charles D'Englere) (09/07/90)

I need help on making a postscript file print inverted (backwards) on
a standard piece of paper. What I mean by backwards or inverted is if
you hold the paper up to a mirror it will read correctly. I have looked
at both the Red and Blue books but there are no examples or information
that I could find on that subject.

Is there any reason to get the Green and Black books? If so, what are
the advantages?

Please email all responses.

Thanks in advance,
Charles


-- 
C. D'Englere Consulting          UUCP: {...!gatech,!emory}!kd4nc!cld
  Charles L. D'Englere             Phone: 404+3259074
    1409 Bronze Leaf Ct.             Stone Mountain, GA 30083

zben@umd5.umd.edu (Ben Cranston) (09/08/90)

In article <5420@kd4nc.UUCP> cld@kd4nc.UUCP (Charles D'Englere) writes:

> I need help on making a postscript file print inverted (backwards) on
> a standard piece of paper. What I mean by backwards or inverted is if
> you hold the paper up to a mirror it will read correctly. I have looked
> at both the Red and Blue books but there are no examples or information
> that I could find on that subject.

If your file is well behaved and only one page simply putting this before it:

     612 0 translate -1 1 scale

should do the trick.  One of the very nice things about Postscript is that
scale will invert the actual character drawing as well as the positioning.

If your file is well behaved but more than one page long you could redefine
the showpage (and maybe copypage if it uses it) operators to first call the
old showpage, then do the above.  Then do it once manually at the beginning
or waste a picotree and just put a showpage between the redefinition and 
your page proper.

The 612 is 8.5 (inches) times 72 (PS "units" per inch), so if your paper is
not 8.5 inches wide the number will need adjustment.  It is possible to
deduced the page width from the initial clipping region, see below.

If your file is not well-behaved (like it is a macintosh command-f file)
there is no easy solution.

> Is there any reason to get the Green and Black books? If so, what are
> the advantages?

The green book talks about integration issues and large postscript programs.
I always buy every primary source available, and only the secondaries needed.
I have red, blue, and green, and will buy black when I see it in the stores.

> Please email all responses.

Sorry, no could do, you didn't post an Internet address and those of us who
are not on Usenet proper cannot easily mail to you...


Here's a prolog that switches from portrait to landscape, by doing the moral
equivalent of this magic:

      612 0 translate 90 rotate

at the top of every page.  Maybe you can modify it into something you can use.

        /showpage [
                /showpage load dup type (operatortype) ne {/exec load} if
                0 -1 1 0 0
                /gsave load /clippath load /pathbbox load /grestore load
                3 -1 /roll load /add load 3 1 /roll load /pop load /pop load
                6 /array load /astore load /concat load
        ] cvx def

Gee, PostScript is *almost* as much fun as assembly language!
-- 
Ben Cranston <zben@umd2.umd.edu>
A determined iconoclast, it would be better to assume the opinion expressed
above is the diametric OPPOSITE to that of the Warm and Fuzzy Network Group
of Egregious State University...