[comp.lang.postscript] "Autoscale" for Postscript ?

bob@teda.UUCP (Bob Armstrong) (02/19/91)

  A simple (I hope) question:  Suppose I want to define a Postscript image
that always maps itself onto the full size of the paper, regardless of
the actual paper size ?  For example, if I printed the same Postscript
program on both A sized and C sized paper, both would exactly fill the
page.

  If I could somehow find the actual device size _at runtime_, in either
device space or 1/72nd units, then I could easily set up a transformation
which maps some arbitrarily fixed size world space (say [0..1, 0..1]) onto
the whole page.  Unfortunately I don't see any way to get the page size
at runtime.

  Put another way, I want to define my user space relative to the actual
paper size rather than in absolute inches.

  I realize that this isn't the original intent of Postscript, but surely
there must be some way to do it ??

Thanks,
Bob Armstrong
{sun,decwrl,pyramid}!teda!bob

rcd@ico.isc.com (Dick Dunn) (02/19/91)

bob@teda.UUCP (Bob Armstrong) writes:

>   A simple (I hope) question:  Suppose I want to define a Postscript image
> that always maps itself onto the full size of the paper, regardless of
> the actual paper size ?  For example, if I printed the same Postscript
> program on both A sized and C sized paper, both would exactly fill the
> page.

>   If I could somehow find the actual device size _at runtime_,...

We just went by almost the same problem, so this probably needs to go into
a FAQ.  (Not a criticism of Armstrong's question)

The initial transformation matrix and the initial clipping path tell you
interesting things about the device itself.  In this case, the initial
clipping path tells you the imageable area, so if you do (preferably within
gsave/grestore, to avoid screwing up other stuff):
	initclip clippath pathbbox
you have the area you can use.  initclip resets the clipping path to the
default startup value; clippath turns the clipping path into the current
path; pathbbox gives you coordinates of lower-left and upper-right corners
of the bounding box of this path.
-- 
Dick Dunn     rcd@ico.isc.com -or- ico!rcd       Boulder, CO   (303)449-2870
   ...But is it art?