[comp.lang.postscript] Imageable area of printer

crs@oxygen.siesoft.co.uk (Chris Smith) (09/12/90)

I have a program that is required to work on two different makes of
PostScript printer with different imageable areas.  How do I write
it so that it can cope with this?

Example:

I want to draw a vertical line in the middle of the imageable area.

If I don't know what the maximum and minimum values of the x-axis are
how can I position the line in the middle of them?

--
===========================================================================
Chris Smith				...!mcvax!ukc!siesoft!crs
					   <crs@siesoft.co.uk>
===========================================================================

p_davis@epik.enet.dec.com (Peter Davis) (09/21/90)

In article <1990Sep12.105456.18945@siesoft.co.uk>, crs@oxygen.siesoft.co.uk (Chris Smith) writes...
>I have a program that is required to work on two different makes of
>PostScript printer with different imageable areas.  How do I write
>it so that it can cope with this?
> 
>Example:
> 
>I want to draw a vertical line in the middle of the imageable area.
> 
>If I don't know what the maximum and minimum values of the x-axis are
>how can I position the line in the middle of them?
> 
>--
>===========================================================================
>Chris Smith				...!mcvax!ukc!siesoft!crs
>					   <crs@siesoft.co.uk>
>===========================================================================

The easiest thing to do is find the default clippath for the device, and use
that.  Do this before you do anything else that might affect the clippath.

Here's an example:

%!
clippath
{
  /miny exch def
  /minx exch def
  /maxy miny def
  /maxx minx def
}
{
  /y exch def
  /x exch def
  y miny lt {/miny y def} if
  x minx lt {/minx x def} if
  y maxy gt {/maxy y def} if
  x maxx gt {/maxx x def} if
}
{
}
{
}
pathforall
minx maxx add 2 div miny moveto
0 maxy miny sub rlineto
stroke
showpage