Revisit https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3161
[obnox/wireshark/wip.git] / print.ps
1 %!
2 %
3 % Code between start/end remarks is put into ps.c
4 % Anything else is thrown away, and is for testing only.
5 %
6 % ---- wireshark preamble start ---- %
7 %!PS-Adobe-2.0
8 %
9 % Wireshark - Network traffic analyzer
10 % By Gerald Combs <gerald@wireshark.org>
11 % Copyright 1998 Gerald Combs
12 %
13 %%Creator: Wireshark
14 %%Title: Wireshark output
15 %%DocumentFonts: Helvetica Monaco
16 %%EndComments
17 %!
18
19 %
20 % Ghostscript http://ghostscript.com/ can convert postscript to pdf files.
21 %
22 % To convert this postscript file to pdf, type (for US letter format):
23 % ps2pdf filename.ps
24 %
25 % or (for A4 format):
26 % ps2pdf -sPAPERSIZE=a4 filename.ps
27 %
28 % ... and of course replace filename.ps by your current filename.
29 %
30 % The pdfmark's below will help converting to a pdf file, and have no
31 % effect when printing the postscript directly.
32
33
34 %   This line is necessary if the file should be printable, and not just used
35 %   for distilling into PDF:
36 %
37 /pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
38 %
39 %   This tells PDF viewers to display bookmarks when the document is opened:
40 %
41 [/PageMode /UseOutlines /DOCVIEW pdfmark
42
43 % Get the Imagable Area of the page
44 clippath pathbbox
45
46 % Set vmax to the vertical size of the page,
47 % hmax to the horizontal size of the page.
48 /vmax exch def
49 /hmax exch def
50 pop pop         % junk
51
52 % 1/2-inch margins
53 /lmargin 36 def                                 % left margin
54 /tmargin vmax 56 sub def                % top margin
55 /bmargin 36 def                                 % bottom margin
56 /pagenumtab hmax 36 sub def             % right margin
57
58 % Counters
59 /thispagenum 1 def
60
61 % Strings
62 /pagenostr 7 string def
63
64
65 /formfeed {
66         printpagedecorations
67         showpage
68         
69         % we need a new current point after showpage is done
70         lmargin         % X
71         vpos            % Y
72         moveto
73         /vpos tmargin def
74 } def
75
76 % Prints text with possible indenting
77 /putline_single {
78         exch 10 mul lmargin add         % X
79         vpos                                            % Y
80         moveto
81         show
82
83         /vpos vpos 10 sub def
84
85         vpos 5 sub bmargin le           % is vpos <= bottom margin?
86         {
87                 formfeed
88         }
89         if                                                      % then formfeed and start at top
90 } def
91
92
93 % Prints text with possible indenting and line wrap
94 /putline {
95         /text exch def
96         /indent exch def
97         
98         % wrapat = width / sizeof font (remember: monospaced font)
99         /pagewidth pagenumtab lmargin sub def
100         /cwidth (A) stringwidth pop def
101         /wrapat pagewidth cwidth div cvi def
102                 
103         text length wrapat le {
104                 % print line
105                 indent text 0 text length getinterval putline_single
106         }{
107                 % print the lines first part
108                 indent text 0 wrapat getinterval putline_single
109                 % print wrapped rest
110                 indent text wrapat text length wrapat sub getinterval putline
111         }
112         ifelse
113 } def
114
115
116 % Prints the page number at the top right
117 /printpagedecorations {
118         gsave
119                 % Set the font to 8 point
120                 /Helvetica findfont 8 scalefont setfont
121
122                 % title
123                 lmargin                                         % X
124                 vmax 36 sub                                     % Y
125                 moveto
126                 ws_pagetitle show
127
128                 % this page number
129                 pagenumtab (Page ) stringwidth pop sub thispagenum pagenostr cvs stringwidth pop sub            % X
130                 vmax 36 sub                                     % Y
131                 moveto
132                 (Page ) show
133                 thispagenum pagenostr cvs show
134
135                 % thispagenum++
136                 /thispagenum thispagenum 1 add def
137                 
138                 % line at top of page
139                 lmargin                                         % X
140                 vmax 38 sub                                     % Y
141                 moveto
142                 
143                 pagenumtab                                      % X
144                 vmax 38 sub                                     % Y
145                 lineto
146                 stroke
147                 
148                 % line at bottom of page
149                 lmargin                                         % X
150                 bmargin                                         % Y
151                 moveto
152                 
153                 pagenumtab                                      % X
154                 bmargin                                         % Y
155                 lineto
156                 stroke
157                 
158         grestore
159 } def
160         
161 % Reset the vertical position
162 /vpos tmargin def
163
164 % Set the font to 8 point
165 /Monaco findfont 8 scalefont setfont
166
167 % ---- wireshark preamble end ---- %
168
169 % the page title
170 /ws_pagetitle (Wireshark) def
171
172 % Display our output lines.
173
174 % PDF bookmark link
175 [/Dest /__frame1__ /Title (Frame 1)   /OUT pdfmark
176 [/View [/XYZ -4 currentpoint matrix currentmatrix matrix defaultmatrix
177  matrix invertmatrix matrix concatmatrix transform exch pop 20 add null]
178  /Dest /__frame1__ /DEST pdfmark
179  
180 % packet data
181 0 (Frame 1) putline
182 0 (Ethernet II \(98 on wire, 68 captured\)) putline
183 1 (Destination: 00:00:0c:36:00:2a) putline
184 1 (Source: 00:c0:4f:c7:eb:c0) putline
185 1 (Type: IP \(0x0800\)) putline
186 0 (Ethernet II \(98 on wire, 68 captured\)) putline
187 1 (Source: 00:c0:4f:c7:eb:c0) putline
188 1 (Type: IP \(0x0800\)) putline
189 0 (Source: 00:c0:4f:c7:eb:c0) putline
190
191 0 () putline
192 0 (0000  cc 00 00 00 00 00 07 02 00 00 00 00 00 00 00 00   ................ ) putline
193 0 (0010  00 00 bd 0e fe 16 01 00 3e 00 03 08 58 4c 20 38   ........>...XL 8 ) putline
194 0 (0020  30 20 49 4d 33 00 16 01 00 34 00 16 01 01 35 00   0 IM3....4....5. ) putline
195 0 (0030  16 01 02 36 00 16 01 03 6e 00 16 01 ff 6f 00 16   ...6....n....o.. ) putline
196 0 (0040  01 ff 70 00 16 01 ff 71 00 16 01 ff 48 00 01 04   ..p....q....H... ) putline
197 0 (0050  ff 03 07 00 24 00 01 01 05 25 00 01 01 05 26 00   ....$....%....&. ) putline
198 0 (0060  01 01 05 27 00 01 01 05 6a 00 01 01 00 6b 00 01   ...'....j....k.. ) putline
199 0 (0070  01 00 6c 00 01 01 00 6d 00 01 01 00 3d 00 01 02   ..l....m....=... ) putline
200 0 (0080  02 00 c0 00 03 08 80 00 00 00 00 00 00 00 b4 00   ................ ) putline
201 0 (0090  01 04 c0 a8 42 ef 39 00 16 08 05 05 05 05 00 00   ....B.9......... ) putline
202 0 (00a0  00 00 00 03 20 36 41 20 52 69 6e 67 00 00 00 00   .... 6A Ring.... ) putline
203 0 (00b0  00 00 00 00 00 00                                 ......           ) putline
204 formfeed
205
206
207 % PDF bookmark link
208 [/Dest /__frame2__ /Title (Frame 2)   /OUT pdfmark
209 [/View [/XYZ -4 currentpoint matrix currentmatrix matrix defaultmatrix
210  matrix invertmatrix matrix concatmatrix transform exch pop 20 add null]
211  /Dest /__frame2__ /DEST pdfmark
212  
213 % packet data
214 0 (Frame 2) putline
215 0 (Ethernet II \(98 on wire, 68 captured\)) putline
216 1 (Destination: 00:00:0c:36:00:2a) putline
217 1 (Source: 00:c0:4f:c7:eb:c0) putline
218 1 (Type: IP \(0x0800\)) putline
219 0 (Ethernet II \(98 on wire, 68 captured\)) putline
220 1 (Source: 00:c0:4f:c7:eb:c0) putline
221 1 (Type: IP \(0x0800\)) putline
222 0 (Source: 00:c0:4f:c7:eb:c0) putline
223
224 0 () putline
225 0 (0000  cc 00 00 00 00 00 07 02 00 00 00 00 00 00 00 00   ................ ) putline
226 0 (0010  00 00 bd 0e fe 16 01 00 3e 00 03 08 58 4c 20 38   ........>...XL 8 ) putline
227 0 (0020  30 20 49 4d 33 00 16 01 00 34 00 16 01 01 35 00   0 IM3....4....5. ) putline
228 0 (0030  16 01 02 36 00 16 01 03 6e 00 16 01 ff 6f 00 16   ...6....n....o.. ) putline
229 0 (0040  01 ff 70 00 16 01 ff 71 00 16 01 ff 48 00 01 04   ..p....q....H... ) putline
230 0 (0050  ff 03 07 00 24 00 01 01 05 25 00 01 01 05 26 00   ....$....%....&. ) putline
231 0 (0060  01 01 05 27 00 01 01 05 6a 00 01 01 00 6b 00 01   ...'....j....k.. ) putline
232 0 (0070  01 00 6c 00 01 01 00 6d 00 01 01 00 3d 00 01 02   ..l....m....=... ) putline
233 0 (0080  02 00 c0 00 03 08 80 00 00 00 00 00 00 00 b4 00   ................ ) putline
234 0 (0090  01 04 c0 a8 42 ef 39 00 16 08 05 05 05 05 00 00   ....B.9......... ) putline
235 0 (00a0  00 00 00 03 20 36 41 20 52 69 6e 67 00 00 00 00   .... 6A Ring.... ) putline
236 0 (00b0  00 00 00 00 00 00                                 ......           ) putline
237
238 % ---- wireshark finale start ---- %
239
240 printpagedecorations
241 showpage
242
243 %%EOF
244
245 % ---- wireshark finale end ---- %