Article View: comp.lang.postscript
Article #6352Re: How do I ask ... the size of the physical page
From: Tom Schneider
Date: Wed, 19 Jun 1991 14:37
Date: Wed, 19 Jun 1991 14:37
158 lines
4335 bytes
4335 bytes
In article <JNP.91Jun3141419@tnds09.tele.nokia.fi> jnp@tnds09.tele.nokia.fi
(J|rgen N|rgaard) writes:
>
> How do I ask ... the size of the physical page on which I'm printing.
---snip ---snip ---snip ---snip ---snip ---snip ---snip ---snip ---snip
%! this is a PostScript program
% version = 1.01 of 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
urx llx sub (Delta x:) print
ury lly sub (Delta y:) print
urx llx sub ury lly sub div (Delta y / Delta x:) print
/tospot { % draw a line to a special spot
% to help keep track of what's happening
gsave currentpoint moveto 200 500 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
---snip ---snip ---snip ---snip ---snip ---snip ---snip ---snip ---snip
Use the output of the previous program to define the 4 variables of the next
program. This way you can display the clip area of your printers on your
screen. The black edge is just OUTSIDE the printable area. I run OpenWindows
and this allows me to see if the figures will fit on the printer's page. It
saves lots of paper.
---snip ---snip ---snip ---snip ---snip ---snip ---snip ---snip ---snip
% set the clip area to the Apple Laserwriter Ntx printer's
% version = 2.01 of ntx.ps 1991 May 7
/llx 14.16 def
/lly 7.92 def
/urx 597.6 def
/ury 784.32 def
/newarea{
% draw a box around the area
llx lly moveto
urx lly lineto
urx ury lineto
llx ury lineto
llx lly lineto
clip
} def
/printedge 1 def
/bigger{
/llx llx printedge sub def
/lly lly printedge sub def
/urx urx printedge add def
/ury ury printedge add def
} def
/smaller{
/llx llx printedge add def
/lly lly printedge add def
/urx urx printedge sub def
/ury ury printedge sub def
} def
gsave
bigger
newarea
0 setgray
fill
smaller
grestore
newarea
gsave
1 setgray
fill
grestore
Technical Details
Message-ID:
<2239@fcs280s.ncifcrf.gov>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!haven.umd.edu!ncifcrf!fcs260c2!tomsReferences:
<JNP.91Jun3141419@tnds09.tele.nokia.fi>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!haven.umd.edu!ncifcrf!fcs260c2!toms From: toms@fcs260c2.ncifcrf.gov (Tom Schneider) Newsgroups: comp.lang.postscript Subject: Re: How do I ask ... the size of the physical page Message-ID: <2239@fcs280s.ncifcrf.gov> Date: 19 Jun 91 14:37:59 GMT References: <JNP.91Jun3141419@tnds09.tele.nokia.fi> Sender: news@ncifcrf.gov Distribution: comp Organization: NCI Supercomputer Facility, Frederick, MD Lines: 158