aboutsummaryrefslogtreecommitdiffstats
path: root/print.ps
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2004-04-20 22:34:08 +0000
committerUlf Lamping <ulf.lamping@web.de>2004-04-20 22:34:08 +0000
commit91e61df84e44d9bcb8ebaab6d169e934b5470650 (patch)
treef7272f97ddd40980514981d259656c262b86adfc /print.ps
parent7709ed1be1eae61bdcad19156fb248ca800e2fad (diff)
changed postscript output:
reduced print margin to 1/2 inch and font size to 8 point, include filename in page header, wrap too long lines svn path=/trunk/; revision=10652
Diffstat (limited to 'print.ps')
-rw-r--r--print.ps77
1 files changed, 52 insertions, 25 deletions
diff --git a/print.ps b/print.ps
index fa77a49bbb..b47eb64b39 100644
--- a/print.ps
+++ b/print.ps
@@ -27,10 +27,16 @@ clippath pathbbox
pop pop % junk
% 1-inch margins
-/lmargin 72 def
-/tmargin vmax 72 sub def
-/bmargin 72 def
-/pagenumtab hmax 72 sub def
+%/lmargin 72 def
+%/tmargin vmax 72 sub def
+%/bmargin 72 def
+%/pagenumtab hmax 72 sub def
+
+% 1/2-inch margins
+/lmargin 36 def
+/tmargin vmax 56 sub def
+/bmargin 36 def
+/pagenumtab hmax 36 sub def
% Counters
/vpos vmax 40 sub def
@@ -39,8 +45,9 @@ pop pop % junk
% Strings
/pagenostr 7 string def
+
% Prints text with possible indenting
-/putline {
+/putline_single {
exch 10 mul lmargin add % X
vpos % Y
moveto
@@ -50,30 +57,52 @@ pop pop % junk
vpos bmargin le % is vpos <= bottom margin?
{
- printpagenum showpage
+ printpageheader
+ showpage
/vpos tmargin def
}
if % then formfeed and start at top
} def
-% A put line with smaller spacing and no formfeed
-/titleline {
- lmargin % X
- vpos % Y
- moveto
- show
- /vpos vpos 8 sub def
+% Prints text with possible indenting and line wrap
+/putline {
+ /text exch def
+ /indent exch def
+
+ % wrapat = width / sizeof font (remember: monospaced font)
+ /pagewidth pagenumtab bmargin sub def
+ /cwidth (A) stringwidth pop def
+ /wrapat pagewidth cwidth div cvi def
+
+ text length wrapat le {
+ % print line
+ indent text 0 text length getinterval putline_single
+ }{
+ % print the lines first part
+ indent text 0 wrapat getinterval putline_single
+ % print wrapped rest
+ indent text wrapat text length wrapat sub getinterval putline
+ }
+ ifelse
} def
+
% Prints the page number at the top right
-/printpagenum {
+/printpageheader {
gsave
% Set the font to 8 point
/Helvetica findfont 8 scalefont setfont
- pagenumtab % X
- vmax 40 sub % Y
+ % title
+ lmargin % X
+ vmax 36 sub % Y
+ moveto
+ eth_pagetitle show
+
+ % this page number
+ pagenumtab (Page ) stringwidth pop sub thispagenum pagenostr cvs stringwidth pop sub % X
+ vmax 36 sub % Y
moveto
(Page ) show
thispagenum pagenostr cvs show
@@ -83,19 +112,17 @@ pop pop % junk
grestore
} def
-% Set the font to 8 point
-/Helvetica findfont 8 scalefont setfont
-
-% Create the title
-(Ethereal) titleline
-
% Reset the vertical position
/vpos tmargin def
-% Set the font to 10 point
-/Courier findfont 10 scalefont setfont
% ---- ethereal preamble end ---- %
+% Set the font to 8 point
+/Courier findfont 8 scalefont setfont
+
+% the page title
+/eth_pagetitle (Ethereal) def
+
% Display our output lines.
0 (Ethernet II \(98 on wire, 68 captured\)) putline
1 (Destination: 00:00:0c:36:00:2a) putline
@@ -124,7 +151,7 @@ pop pop % junk
% If this is not the first page, then print the page number
thispagenum 1 gt % is thispagenum > 1 ?
{
- printpagenum
+ printpageheader
}
if