Article View: comp.lang.postscript
Article #4706Re: How do I determine a printer's imaging area?
From: Tom Schneider
Date: Tue, 12 Feb 1991 18:04
Date: Tue, 12 Feb 1991 18:04
97 lines
2965 bytes
2965 bytes
In my previous posting I gave an incorrect program!! Oops. Here is
a corrected version (at least I HOPE so) with some more bells and
whistles that help figure things out:
%! this is a PostScript program
% printerarea.ps
% 1991 February 12
% This program determines the printable area of a printer
% and prints the coordinates out in readable form.
% In addition, it draws a rectangle around the area,
% then it makes a series of shrinking rectangles to help
% visualize where the boundary is. Finally, the corners
% of all these rectangles are connected to a single
% point on the image, to make it clear what is going on.
% Tom Schneider
% National Cancer Institute
% Laboratory of Mathematical Biology
% Frederick, Maryland 21702-1201
% toms@ncifcrf.gov
erasepage
/Times-Roman findfont 30 scalefont setfont
/down {0 -50 rmoveto} def
/print {gsave show 10 string cvs show grestore down} def
% obtain the imagable area of the printer using initclip
gsave initclip clippath pathbbox grestore
%pstack % use this if you want to see the stack
% while running the program
% capture the corners of the imagable area
% (see pathbbox in the red book)
/ury exch def
/urx exch def
/lly exch def
/llx exch def
% use the following if you want to see the values
% llx lly urx ury
% pstack % this stack should match the first one
% clear
150 450 moveto
(printer imageable area:) gsave show grestore down
% print the values
llx ( lower left x [llx]: ) print
lly ( lower left y [lly]: ) print
urx (upper right x [urx]: ) print
ury (upper right y [ury]: ) print
/tospot { % draw a line to a special spot
% to help keep track of what's happening
gsave currentpoint moveto 100 400 lineto stroke grestore
} def
/roundstroke{
% draw a box around the area
llx lly moveto
tospot
urx lly lineto
tospot
urx ury lineto
tospot
llx ury lineto
tospot
llx lly lineto
tospot
stroke
} def
/shift 20 def % amount to decrease the area each time
/shiftinward {
% reduction of the area by the amount shift
/ury ury shift sub def
/urx urx shift sub def
/lly lly shift add def
/llx llx shift add def
} def
% draw a series of decreasing boxes to help figure
% things out
roundstroke
shiftinward
roundstroke
shiftinward
roundstroke
shiftinward
roundstroke
shiftinward
roundstroke
showpage
Technical Details
Message-ID:
<2052@fcs280s.ncifcrf.gov>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!caen!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven!ncifcrf!fcs260c2!tomsReferences:
<1991Feb8.174934.5816@eagle.lerc.nasa.gov> <7723@exodus.Eng.Sun.COM> <2047@fcs280s.ncifcrf.gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!caen!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven!ncifcrf!fcs260c2!toms From: toms@fcs260c2.ncifcrf.gov (Tom Schneider) Newsgroups: comp.lang.postscript Subject: Re: How do I determine a printer's imaging area? Message-ID: <2052@fcs280s.ncifcrf.gov> Date: 12 Feb 91 18:04:37 GMT References: <1991Feb8.174934.5816@eagle.lerc.nasa.gov> <7723@exodus.Eng.Sun.COM> <2047@fcs280s.ncifcrf.gov> Sender: news@ncifcrf.gov Organization: NCI Supercomputer Facility, Frederick, MD Lines: 97