Update minimum version requirement for GTK to 2.12.
[obnox/wireshark/wip.git] / print.ps
index 1b6528aa540e83747d6e3cb8a0ae4ec1b6811dcb..5ae242934c7eba7c394d451f7824b2da14436c82 100644 (file)
--- a/print.ps
+++ b/print.ps
@@ -3,20 +3,43 @@
 % Code between start/end remarks is put into ps.c
 % Anything else is thrown away, and is for testing only.
 %
-% ---- ethereal preamble start ---- %
-%!
+% ---- wireshark preamble start ---- %
 %!PS-Adobe-2.0
 %
-% Ethereal - Network traffic analyzer
-% By Gerald Combs <gerald@zing.org>
+% Wireshark - Network traffic analyzer
+% By Gerald Combs <gerald@wireshark.org>
 % Copyright 1998 Gerald Combs
 %
-%%Creator: Ethereal
-%%Title: ethereal.ps
-%%DocumentFonts: Helvetica Courier
+%%Creator: Wireshark
+%%Title: Wireshark output
+%%DocumentFonts: Helvetica Monaco
 %%EndComments
 %!
 
+%
+% Ghostscript http://ghostscript.com/ can convert postscript to pdf files.
+%
+% To convert this postscript file to pdf, type (for US letter format):
+% ps2pdf filename.ps
+%
+% or (for A4 format):
+% ps2pdf -sPAPERSIZE=a4 filename.ps
+%
+% ... and of course replace filename.ps by your current filename.
+%
+% The pdfmark's below will help converting to a pdf file, and have no
+% effect when printing the postscript directly.
+% 
+
+%   This line is necessary if the file should be printable, and not just used
+%   for distilling into PDF:
+%
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+%
+%   This tells PDF viewers to display bookmarks when the document is opened:
+%
+[/PageMode /UseOutlines /DOCVIEW pdfmark
+
 % Get the Imagable Area of the page
 clippath pathbbox
 
@@ -26,21 +49,32 @@ clippath pathbbox
 /hmax exch def
 pop pop                % junk
 
-% 1-inch margins
-/lmargin 72 def
-/tmargin vmax 72 sub def
-/bmargin 72 def
-/pagenumtab hmax 72 sub def
+% 1/2-inch margins
+/lmargin 36 def                                        % left margin
+/tmargin vmax 56 sub def               % top margin
+/bmargin 36 def                                        % bottom margin
+/pagenumtab hmax 36 sub def            % right margin
 
 % Counters
-/vpos vmax 40 sub def
 /thispagenum 1 def
 
 % Strings
 /pagenostr 7 string def
 
+
+/formfeed {
+       printpagedecorations
+       showpage
+       
+       % we need a new current point after showpage is done
+       lmargin         % X
+       vpos            % Y
+       moveto
+       /vpos tmargin def
+} def
+
 % Prints text with possible indenting
-/putline {
+/putline_single {
        exch 10 mul lmargin add         % X
        vpos                                            % Y
        moveto
@@ -48,72 +82,103 @@ pop pop            % junk
 
        /vpos vpos 10 sub def
 
-       vpos bmargin le                         % is vpos <= bottom margin?
+       vpos 5 sub bmargin le           % is vpos <= bottom margin?
        {
-               printpagenum showpage
-               /vpos tmargin def
+               formfeed
        }
        if                                                      % then formfeed and start at top
 } def
 
-% A putline with no indenting
-/hexdump {
-       lmargin                                         % X
-       vpos                                            % Y
-       moveto
-       show
 
-       /vpos vpos 10 sub def
-
-       vpos bmargin le                         % is vpos <= bottom margin?
-       {
-               printpagenum showpage
-               /vpos tmargin 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 lmargin 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
        }
-       if                                                      % then formfeed and start at top
+       ifelse
 } def
 
-% A put line with smaller spacing and no formfeed
-/titleline {
-       lmargin                                         % X
-       vpos                                            % Y
-       moveto
-       show
-
-       /vpos vpos 8 sub def
-} def
 
 % Prints the page number at the top right
-/printpagenum {
+/printpagedecorations {
        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
+               ws_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
 
                % thispagenum++
                /thispagenum thispagenum 1 add def
+               
+               % line at top of page
+               lmargin                                         % X
+               vmax 38 sub                                     % Y
+               moveto
+               
+               pagenumtab                                      % X
+               vmax 38 sub                                     % Y
+               lineto
+               stroke
+               
+               % line at bottom of page
+               lmargin                                         % X
+               bmargin                                         % Y
+               moveto
+               
+               pagenumtab                                      % X
+               bmargin                                         % Y
+               lineto
+               stroke
+               
        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
+/Monaco findfont 8 scalefont setfont
+
+% ---- wireshark preamble end ---- %
+
+% the page title
+/ws_pagetitle (Wireshark) def
 
 % Display our output lines.
+
+% PDF bookmark link
+[/Dest /__frame1__ /Title (Frame 1)   /OUT pdfmark
+[/View [/XYZ -4 currentpoint matrix currentmatrix matrix defaultmatrix
+ matrix invertmatrix matrix concatmatrix transform exch pop 20 add null]
+ /Dest /__frame1__ /DEST pdfmark
+% packet data
+0 (Frame 1) putline
 0 (Ethernet II \(98 on wire, 68 captured\)) putline
 1 (Destination: 00:00:0c:36:00:2a) putline
 1 (Source: 00:c0:4f:c7:eb:c0) putline
@@ -123,32 +188,58 @@ pop pop           % junk
 1 (Type: IP \(0x0800\)) putline
 0 (Source: 00:c0:4f:c7:eb:c0) putline
 
-% ---- ethereal hex start ---- %
-% Set the font to 10 point
-/Courier findfont 10 scalefont setfont
-() hexdump
-% ---- ethereal hex end ---- %
-
-(   0  cc00 0000 0000 0702 0000 0000 0000 0000   ................ ) hexdump
-(  10  0000 bd0e fe16 0100 3e00 0308 584c 2038   ........>...XL 8 ) hexdump
-(  20  3020 494d 3300 1601 0034 0016 0101 3500   0 IM3....4....5. ) hexdump
-(  30  1601 0236 0016 0103 6e00 1601 ff6f 0016   ...6....n....o.. ) hexdump
-(  40  01ff 7000 1601 ff71 0016 01ff 4800 0104   ..p....q....H... ) hexdump
-(  50  ff03 0700 2400 0101 0525 0001 0105 2600   ....$....%....&. ) hexdump
-(  60  0101 0527 0001 0105 6a00 0101 006b 0001   ...'....j....k.. ) hexdump
-(  70  0100 6c00 0101 006d 0001 0100 3d00 0102   ..l....m....=... ) hexdump
-(  80  0200 c000 0308 8000 0000 0000 0000 b400   ................ ) hexdump
-(  90  0104 c0a8 42ef 3900 1608 0505 0505 0000   ....B.9......... ) hexdump
-(  a0  0000 0003 2036 4120 5269 6e67 0000 0000   .... 6A Ring.... ) hexdump
-(  b0  0000 0000 0000                            ......           ) hexdump
-
-% ---- ethereal finale start ---- %
-% If this is not the first page, then print the page number
-thispagenum 1 gt                               % is thispagenum > 1 ?
-{
-       printpagenum
-}
-if
+0 () putline
+0 (0000  cc 00 00 00 00 00 07 02 00 00 00 00 00 00 00 00   ................ ) putline
+0 (0010  00 00 bd 0e fe 16 01 00 3e 00 03 08 58 4c 20 38   ........>...XL 8 ) putline
+0 (0020  30 20 49 4d 33 00 16 01 00 34 00 16 01 01 35 00   0 IM3....4....5. ) putline
+0 (0030  16 01 02 36 00 16 01 03 6e 00 16 01 ff 6f 00 16   ...6....n....o.. ) putline
+0 (0040  01 ff 70 00 16 01 ff 71 00 16 01 ff 48 00 01 04   ..p....q....H... ) putline
+0 (0050  ff 03 07 00 24 00 01 01 05 25 00 01 01 05 26 00   ....$....%....&. ) putline
+0 (0060  01 01 05 27 00 01 01 05 6a 00 01 01 00 6b 00 01   ...'....j....k.. ) putline
+0 (0070  01 00 6c 00 01 01 00 6d 00 01 01 00 3d 00 01 02   ..l....m....=... ) putline
+0 (0080  02 00 c0 00 03 08 80 00 00 00 00 00 00 00 b4 00   ................ ) putline
+0 (0090  01 04 c0 a8 42 ef 39 00 16 08 05 05 05 05 00 00   ....B.9......... ) putline
+0 (00a0  00 00 00 03 20 36 41 20 52 69 6e 67 00 00 00 00   .... 6A Ring.... ) putline
+0 (00b0  00 00 00 00 00 00                                 ......           ) putline
+formfeed
+
+
+% PDF bookmark link
+[/Dest /__frame2__ /Title (Frame 2)   /OUT pdfmark
+[/View [/XYZ -4 currentpoint matrix currentmatrix matrix defaultmatrix
+ matrix invertmatrix matrix concatmatrix transform exch pop 20 add null]
+ /Dest /__frame2__ /DEST pdfmark
+% packet data
+0 (Frame 2) putline
+0 (Ethernet II \(98 on wire, 68 captured\)) putline
+1 (Destination: 00:00:0c:36:00:2a) putline
+1 (Source: 00:c0:4f:c7:eb:c0) putline
+1 (Type: IP \(0x0800\)) putline
+0 (Ethernet II \(98 on wire, 68 captured\)) putline
+1 (Source: 00:c0:4f:c7:eb:c0) putline
+1 (Type: IP \(0x0800\)) putline
+0 (Source: 00:c0:4f:c7:eb:c0) putline
 
+0 () putline
+0 (0000  cc 00 00 00 00 00 07 02 00 00 00 00 00 00 00 00   ................ ) putline
+0 (0010  00 00 bd 0e fe 16 01 00 3e 00 03 08 58 4c 20 38   ........>...XL 8 ) putline
+0 (0020  30 20 49 4d 33 00 16 01 00 34 00 16 01 01 35 00   0 IM3....4....5. ) putline
+0 (0030  16 01 02 36 00 16 01 03 6e 00 16 01 ff 6f 00 16   ...6....n....o.. ) putline
+0 (0040  01 ff 70 00 16 01 ff 71 00 16 01 ff 48 00 01 04   ..p....q....H... ) putline
+0 (0050  ff 03 07 00 24 00 01 01 05 25 00 01 01 05 26 00   ....$....%....&. ) putline
+0 (0060  01 01 05 27 00 01 01 05 6a 00 01 01 00 6b 00 01   ...'....j....k.. ) putline
+0 (0070  01 00 6c 00 01 01 00 6d 00 01 01 00 3d 00 01 02   ..l....m....=... ) putline
+0 (0080  02 00 c0 00 03 08 80 00 00 00 00 00 00 00 b4 00   ................ ) putline
+0 (0090  01 04 c0 a8 42 ef 39 00 16 08 05 05 05 05 00 00   ....B.9......... ) putline
+0 (00a0  00 00 00 03 20 36 41 20 52 69 6e 67 00 00 00 00   .... 6A Ring.... ) putline
+0 (00b0  00 00 00 00 00 00                                 ......           ) putline
+
+% ---- wireshark finale start ---- %
+
+printpagedecorations
 showpage
-% ---- ethereal finale end ---- %
+
+%%EOF
+
+% ---- wireshark finale end ---- %