2 |
- |
1 |
% Copyright (C) 1989, 1996 Aladdin Enterprises. All rights reserved.
|
|
|
2 |
%
|
|
|
3 |
% This software is provided AS-IS with no warranty, either express or
|
|
|
4 |
% implied.
|
|
|
5 |
%
|
|
|
6 |
% This software is distributed under license and may not be copied,
|
|
|
7 |
% modified or distributed except as expressly authorized under the terms
|
|
|
8 |
% of the license contained in the file LICENSE in this distribution.
|
|
|
9 |
%
|
|
|
10 |
% For more information about licensing, please refer to
|
|
|
11 |
% http://www.ghostscript.com/licensing/. For information on
|
|
|
12 |
% commercial licensing, go to http://www.artifex.com/licensing/ or
|
|
|
13 |
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
|
|
|
14 |
% San Rafael, CA 94903, U.S.A., +1(415)492-9861.
|
|
|
15 |
|
|
|
16 |
% $Id: align.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
|
|
|
17 |
% Print a page that indicates the proper settings of Margins and HWMargins
|
|
|
18 |
% for a given device. Requires a Level 2 system.
|
|
|
19 |
|
|
|
20 |
% Reset the offset and margins.
|
|
|
21 |
|
|
|
22 |
<<
|
|
|
23 |
/PageOffset [0 0]
|
|
|
24 |
/Margins [0 0]
|
|
|
25 |
/.HWMargins [0 0 0 0]
|
|
|
26 |
>>
|
|
|
27 |
setpagedevice
|
|
|
28 |
<<
|
|
|
29 |
/ImagingBBox null
|
|
|
30 |
>>
|
|
|
31 |
setpagedevice
|
|
|
32 |
|
|
|
33 |
% Determine the actual page size.
|
|
|
34 |
|
|
|
35 |
clippath pathbbox newpath
|
|
|
36 |
/y1 exch def /x1 exch def pop pop
|
|
|
37 |
|
|
|
38 |
% Draw lines that should be exactly 1" in from each edge,
|
|
|
39 |
% and should extend precisely to the edge of the paper.
|
|
|
40 |
|
|
|
41 |
1 setlinewidth
|
|
|
42 |
|
|
|
43 |
72 0 moveto 0 y1 rlineto stroke
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
% Print the text in the middle of the page.
|
|
|
47 |
|
|
|
48 |
/S 80 string def
|
|
|
49 |
108 480 moveto
|
|
|
50 |
/Helvetica 12 selectfont
|
|
|
51 |
{ currentfile S readline pop dup (%END) eq { pop exit } if
|
|
|
52 |
gsave show grestore 0 -15 rmoveto
|
|
|
53 |
} loop
|
|
|
54 |
Let the distance in inches from the left edge of the page to
|
|
|
55 |
the vertical line be H, and from the bottom edge to the
|
|
|
56 |
horizontal line be V; let the lengths of the gaps at the top
|
|
|
57 |
and bottom of the vertical line be T and B respectively, and
|
|
|
58 |
the gaps at the left and right of the horizontal line be L
|
|
|
59 |
and R. For correct alignment of pages, put the following line
|
|
|
60 |
in a file named (for example) margins.ps, and then mention
|
|
|
61 |
margins.ps on the gs command line when printing any of your
|
|
|
62 |
own files:
|
|
|
63 |
|
|
|
64 |
<< /.HWMargins [ml mb mr mt] /Margins [x y] >> setpagedevice
|
|
|
65 |
|
|
|
66 |
where
|
|
|
67 |
ml = L * 72, mb = B * 72, mr = R * 72, mt = T * 72,
|
|
|
68 |
%END
|
|
|
69 |
/res currentpagedevice /.MarginsHWResolution get def
|
|
|
70 |
( x = (1 - H) * ) show res 0 get =string cvs show
|
|
|
71 |
(, y = (V - 1) * ) show res 1 get =string cvs show
|
|
|
72 |
|
|
|
73 |
showpage
|