Mercurial > hg > RemoteEditor > vim7
comparison runtime/doc/print.txt @ 0:76efa0be13f1
Initial revision
author | atsuki |
---|---|
date | Sat, 10 Nov 2007 15:07:22 +0900 |
parents | |
children | e170173ecb68 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:76efa0be13f1 |
---|---|
1 *print.txt* For Vim version 7.1. Last change: 2007 Apr 22 | |
2 | |
3 | |
4 VIM REFERENCE MANUAL by Bram Moolenaar | |
5 | |
6 | |
7 Printing *printing* | |
8 | |
9 1. Introduction |print-intro| | |
10 2. Print options |print-options| | |
11 3. PostScript Printing |postscript-printing| | |
12 4. PostScript Printing Encoding |postscript-print-encoding| | |
13 5. PostScript CJK Printing |postscript-cjk-printing| | |
14 6. PostScript Printing Troubleshooting |postscript-print-trouble| | |
15 7. PostScript Utilities |postscript-print-util| | |
16 8. Formfeed Characters |printing-formfeed| | |
17 | |
18 {Vi has None of this} | |
19 {only available when compiled with the |+printer| feature} | |
20 | |
21 ============================================================================== | |
22 1. Introduction *print-intro* | |
23 | |
24 On MS-Windows Vim can print your text on any installed printer. On other | |
25 systems a PostScript file is produced. This can be directly sent to a | |
26 PostScript printer. For other printers a program like ghostscript needs to be | |
27 used. | |
28 | |
29 *:ha* *:hardcopy* *E237* *E238* *E324* | |
30 :[range]ha[rdcopy][!] [arguments] | |
31 Send [range] lines (default whole file) to the | |
32 printer. | |
33 | |
34 On MS-Windows a dialog is displayed to allow selection | |
35 of printer, paper size etc. To skip the dialog, use | |
36 the [!]. In this case the printer defined by | |
37 'printdevice' is used, or, if 'printdevice' is empty, | |
38 the system default printer. | |
39 | |
40 For systems other than MS-Windows, PostScript is | |
41 written in a temp file and 'printexpr' is used to | |
42 actually print it. Then [arguments] can be used by | |
43 'printexpr' through |v:cmdarg|. Otherwise [arguments] | |
44 is ignored. 'printoptions' can be used to specify | |
45 paper size, duplex, etc. | |
46 | |
47 :[range]ha[rdcopy][!] >{filename} | |
48 As above, but write the resulting PostScript in file | |
49 {filename}. | |
50 Things like "%" are expanded |cmdline-special| | |
51 Careful: An existing file is silently overwritten. | |
52 {only available when compiled with the |+postscript| | |
53 feature} | |
54 On MS-Windows use the "print to file" feature of the | |
55 printer driver. | |
56 | |
57 Progress is displayed during printing as a page number and a percentage. To | |
58 abort printing use the interrupt key (CTRL-C or, on MS-systems, CTRL-Break). | |
59 | |
60 Printer output is controlled by the 'printfont' and 'printoptions' options. | |
61 'printheader' specifies the format of a page header. | |
62 | |
63 The printed file is always limited to the selected margins, irrespective of | |
64 the current window's 'wrap' or 'linebreak' settings. The "wrap" item in | |
65 'printoptions' can be used to switch wrapping off. | |
66 The current highlighting colors are used in the printout, with the following | |
67 considerations: | |
68 1) The normal background is always rendered as white (i.e. blank paper). | |
69 2) White text or the default foreground is rendered as black, so that it shows | |
70 up! | |
71 3) If 'background' is "dark", then the colours are darkened to compensate for | |
72 the fact that otherwise they would be too bright to show up clearly on | |
73 white paper. | |
74 | |
75 ============================================================================== | |
76 2. Print options *print-options* | |
77 | |
78 Here are the details for the options that change the way printing is done. | |
79 For generic info about setting options see |options.txt|. | |
80 | |
81 *pdev-option* | |
82 'printdevice' 'pdev' string (default empty) | |
83 global | |
84 This defines the name of the printer to be used when the |:hardcopy| command | |
85 is issued with a bang (!) to skip the printer selection dialog. On Win32, it | |
86 should be the printer name exactly as it appears in the standard printer | |
87 dialog. | |
88 If the option is empty, then vim will use the system default printer for | |
89 ":hardcopy!" | |
90 | |
91 *penc-option* *E620* | |
92 'printencoding' 'penc' String (default empty, except for: | |
93 Windows, OS/2: cp1252, | |
94 Macintosh: mac-roman, | |
95 VMS: dec-mcs, | |
96 HPUX: hp-roman8, | |
97 EBCDIC: ebcdic-uk) | |
98 global | |
99 Sets the character encoding used when printing. This option tells VIM which | |
100 print character encoding file from the "print" directory in 'runtimepath' to | |
101 use. | |
102 | |
103 This option will accept any value from |encoding-names|. Any recognized names | |
104 are converted to VIM standard names - see 'encoding' for more details. Names | |
105 not recognized by VIM will just be converted to lower case and underscores | |
106 replaced with '-' signs. | |
107 | |
108 If 'printencoding' is empty or VIM cannot find the file then it will use | |
109 'encoding' (if VIM is compiled with |+multi_byte| and it is set an 8-bit | |
110 encoding) to find the print character encoding file. If VIM is unable to find | |
111 a character encoding file then it will use the "latin1" print character | |
112 encoding file. | |
113 | |
114 When 'encoding' is set to a multi-byte encoding, VIM will try to convert | |
115 characters to the printing encoding for printing (if 'printencoding' is empty | |
116 then the conversion will be to latin1). Conversion to a printing encoding | |
117 other than latin1 will require VIM to be compiled with the |+iconv| feature. | |
118 If no conversion is possible then printing will fail. Any characters that | |
119 cannot be converted will be replaced with upside down question marks. | |
120 | |
121 Four print character encoding files are provided to support default Mac, VMS, | |
122 HPUX, and EBCDIC character encodings and are used by default on these | |
123 platforms. Code page 1252 print character encoding is used by default on | |
124 Windows and OS/2 platforms. | |
125 | |
126 *pexpr-option* | |
127 'printexpr' 'pexpr' String (default: see below) | |
128 global | |
129 Expression that is evaluated to print the PostScript produced with | |
130 |:hardcopy|. | |
131 The file name to be printed is in |v:fname_in|. | |
132 The arguments to the ":hardcopy" command are in |v:cmdarg|. | |
133 The expression must take care of deleting the file after printing it. | |
134 When there is an error, the expression must return a non-zero number. | |
135 If there is no error, return zero or an empty string. | |
136 The default for non MS-Windows or VMS systems is to simply use "lpr" to print | |
137 the file: > | |
138 | |
139 system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) | |
140 . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error | |
141 | |
142 On MS-Dos, MS-Windows and OS/2 machines the default is to copy the file to the | |
143 currently specified printdevice: > | |
144 | |
145 system('copy' . ' ' . v:fname_in . (&printdevice == '' | |
146 ? ' LPT1:' : (' \"' . &printdevice . '\"'))) | |
147 . delete(v:fname_in) | |
148 | |
149 On VMS machines the default is to send the file to either the default or | |
150 currently specified printdevice: > | |
151 | |
152 system('print' . (&printdevice == '' ? '' : ' /queue=' . | |
153 &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) | |
154 | |
155 If you change this option, using a function is an easy way to avoid having to | |
156 escape all the spaces. Example: > | |
157 | |
158 :set printexpr=PrintFile(v:fname_in) | |
159 :function PrintFile(fname) | |
160 : call system("ghostview " . a:fname) | |
161 : call delete(a:fname) | |
162 : return v:shell_error | |
163 :endfunc | |
164 | |
165 Be aware that some print programs return control before they have read the | |
166 file. If you delete the file too soon it will not be printed. These programs | |
167 usually offer an option to have them remove the file when printing is done. | |
168 *E365* | |
169 If evaluating the expression fails or it results in a non-zero number, you get | |
170 an error message. In that case Vim will delete the file. In the default | |
171 value for non-MS-Windows a trick is used: Adding "v:shell_error" will result | |
172 in a non-zero number when the system() call fails. | |
173 | |
174 This option cannot be set from a |modeline| or in the |sandbox|, for security | |
175 reasons. | |
176 | |
177 *pfn-option* *E613* | |
178 'printfont' 'pfn' string (default "courier") | |
179 global | |
180 This is the name of the font that will be used for the |:hardcopy| command's | |
181 output. It has the same format as the 'guifont' option, except that only one | |
182 font may be named, and the special "guifont=*" syntax is not available. | |
183 | |
184 In the Win32 GUI version this specifies a font name with its extra attributes, | |
185 as with the 'guifont' option. | |
186 | |
187 For other systems, only ":h11" is recognized, where "11" is the point size of | |
188 the font. When omitted, the point size is 10. | |
189 | |
190 *pheader-option* | |
191 'printheader' 'pheader' string (default "%<%f%h%m%=Page %N") | |
192 global | |
193 This defines the format of the header produced in |:hardcopy| output. The | |
194 option is defined in the same way as the 'statusline' option. If Vim has not | |
195 been compiled with the |+statusline| feature, this option has no effect and a | |
196 simple default header is used, which shows the page number. | |
197 | |
198 *pmbcs-option* | |
199 'printmbcharset' 'pmbcs' string (default "") | |
200 global | |
201 Sets the CJK character set to be used when generating CJK output from | |
202 |:hardcopy|. The following predefined values are currently recognised by VIM: | |
203 | |
204 Value Description ~ | |
205 Chinese GB_2312-80 | |
206 (Simplified) GBT_12345-90 | |
207 MAC Apple Mac Simplified Chinese | |
208 GBT-90_MAC GB/T 12345-90 Apple Mac Simplified | |
209 Chinese | |
210 GBK GBK (GB 13000.1-93) | |
211 ISO10646 ISO 10646-1:1993 | |
212 | |
213 Chinese CNS_1993 CNS 11643-1993, Planes 1 & 2 | |
214 (Traditional) BIG5 | |
215 ETEN Big5 with ETen extensions | |
216 ISO10646 ISO 10646-1:1993 | |
217 | |
218 Japanese JIS_C_1978 | |
219 JIS_X_1983 | |
220 JIS_X_1990 | |
221 MSWINDOWS Win3.1/95J (JIS X 1997 + NEC + | |
222 IBM extensions) | |
223 KANJITALK6 Apple Mac KanjiTalk V6.x | |
224 KANJITALK7 Apple Mac KanjiTalk V7.x | |
225 | |
226 Korean KS_X_1992 | |
227 MAC Apple Macintosh Korean | |
228 MSWINDOWS KS X 1992 with MS extensions | |
229 ISO10646 ISO 10646-1:1993 | |
230 | |
231 Only certain combinations of the above values and 'printencoding' are | |
232 possible. The following tables show the valid combinations: | |
233 | |
234 euc-cn gbk ucs-2 utf-8 ~ | |
235 Chinese GB_2312-80 x | |
236 (Simplified) GBT_12345-90 x | |
237 MAC x | |
238 GBT-90_MAC x | |
239 GBK x | |
240 ISO10646 x x | |
241 | |
242 euc-tw big5 ucs-2 utf-8 ~ | |
243 Chinese CNS_1993 x | |
244 (Traditional) BIG5 x | |
245 ETEN x | |
246 ISO10646 x x | |
247 | |
248 euc-jp sjis ucs-2 utf-8 ~ | |
249 Japanese JIS_C_1978 x x | |
250 JIS_X_1983 x x | |
251 JIS_X_1990 x x x | |
252 MSWINDOWS x | |
253 KANJITALK6 x | |
254 KANJITALK7 x | |
255 | |
256 euc-kr cp949 ucs-2 utf-8 ~ | |
257 Korean KS_X_1992 x | |
258 MAC x | |
259 MSWINDOWS x | |
260 ISO10646 x x | |
261 | |
262 To set up the correct encoding and character set for printing some | |
263 Japanese text you would do the following; > | |
264 :set printencoding=euc-jp | |
265 :set printmbcharset=JIS_X_1983 | |
266 | |
267 If 'printmbcharset' is not one of the above values then it is assumed to | |
268 specify a custom multi-byte character set and no check will be made that it is | |
269 compatible with the value for 'printencoding'. VIM will look for a file | |
270 defining the character set in the "print" directory in 'runtimepath'. | |
271 | |
272 *pmbfn-option* | |
273 'printmbfont' 'pmbfn' string (default "") | |
274 global | |
275 This is a comma-separated list of fields for font names to be used when | |
276 generating CJK output from |:hardcopy|. Each font name has to be preceded | |
277 with a letter indicating the style the font is to be used for as follows: | |
278 | |
279 r:{font-name} font to use for normal characters | |
280 b:{font-name} font to use for bold characters | |
281 i:{font-name} font to use for italic characters | |
282 o:{font-name} font to use for bold-italic characters | |
283 | |
284 A field with the r: prefix must be specified when doing CJK printing. The | |
285 other fontname specifiers are optional. If a specifier is missing then | |
286 another font will be used as follows: | |
287 | |
288 if b: is missing, then use r: | |
289 if i: is missing, then use r: | |
290 if o: is missing, then use b: | |
291 | |
292 Some CJK fonts do not contain characters for codes in the ASCII code range. | |
293 Also, some characters in the CJK ASCII code ranges differ in a few code points | |
294 from traditional ASCII characters. There are two additional fields to control | |
295 printing of characters in the ASCII code range. | |
296 | |
297 c:yes Use Courier font for characters in the ASCII | |
298 c:no (default) code range. | |
299 | |
300 a:yes Use ASCII character set for codes in the ASCII | |
301 a:no (default) code range. | |
302 | |
303 The following is an example of specifying two multi-byte fonts, one for normal | |
304 and italic printing and one for bold and bold-italic printing, and using | |
305 Courier to print codes in the ASCII code range but using the national | |
306 character set: > | |
307 :set printmbfont=r:WadaMin-Regular,b:WadaMin-Bold,c:yes | |
308 < | |
309 *popt-option* | |
310 'printoptions' 'popt' string (default "") | |
311 global | |
312 This is a comma-separated list of items that control the format of the output | |
313 of |:hardcopy|: | |
314 | |
315 left:{spec} left margin (default: 10pc) | |
316 right:{spec} right margin (default: 5pc) | |
317 top:{spec} top margin (default: 5pc) | |
318 bottom:{spec} bottom margin (default: 5pc) | |
319 {spec} is a number followed by "in" for inches, "pt" | |
320 for points (1 point is 1/72 of an inch), "mm" for | |
321 millimeters or "pc" for a percentage of the media | |
322 size. | |
323 Weird example: | |
324 left:2in,top:30pt,right:16mm,bottom:3pc | |
325 If the unit is not recognized there is no error and | |
326 the default value is used. | |
327 | |
328 header:{nr} Number of lines to reserve for the header. | |
329 Only the first line is actually filled, thus when {nr} | |
330 is 2 there is one empty line. The header is formatted | |
331 according to 'printheader'. | |
332 header:0 Do not print a header. | |
333 header:2 (default) Use two lines for the header | |
334 | |
335 syntax:n Do not use syntax highlighting. This is faster and | |
336 thus useful when printing large files. | |
337 syntax:y Do syntax highlighting. | |
338 syntax:a (default) Use syntax highlighting if the printer appears to be | |
339 able to print color or grey. | |
340 | |
341 number:y Include line numbers in the printed output. | |
342 number:n (default) No line numbers. | |
343 | |
344 wrap:y (default) Wrap long lines. | |
345 wrap:n Truncate long lines. | |
346 | |
347 duplex:off Print on one side. | |
348 duplex:long (default) Print on both sides (when possible), bind on long | |
349 side. | |
350 duplex:short Print on both sides (when possible), bind on short | |
351 side. | |
352 | |
353 collate:y (default) Collating: 1 2 3, 1 2 3, 1 2 3 | |
354 collate:n No collating: 1 1 1, 2 2 2, 3 3 3 | |
355 | |
356 jobsplit:n (default) Do all copies in one print job | |
357 jobsplit:y Do each copy as a separate print job. Useful when | |
358 doing N-up postprocessing. | |
359 | |
360 portrait:y (default) Orientation is portrait. | |
361 portrait:n Orientation is landscape. | |
362 *a4* *letter* | |
363 paper:A4 (default) Paper size: A4 | |
364 paper:{name} Paper size from this table: | |
365 {name} size in cm size in inch ~ | |
366 10x14 25.4 x 35.57 10 x 14 | |
367 A3 29.7 x 42 11.69 x 16.54 | |
368 A4 21 x 29.7 8.27 x 11.69 | |
369 A5 14.8 x 21 5.83 x 8.27 | |
370 B4 25 x 35.3 10.12 x 14.33 | |
371 B5 17.6 x 25 7.17 x 10.12 | |
372 executive 18.42 x 26.67 7.25 x 10.5 | |
373 folio 21 x 33 8.27 x 13 | |
374 ledger 43.13 x 27.96 17 x 11 | |
375 legal 21.59 x 35.57 8.5 x 14 | |
376 letter 21.59 x 27.96 8.5 x 11 | |
377 quarto 21.59 x 27.5 8.5 x 10.83 | |
378 statement 13.97 x 21.59 5.5 x 8.5 | |
379 tabloid 27.96 x 43.13 11 x 17 | |
380 | |
381 formfeed:n (default) Treat form feed characters (0x0c) as a normal print | |
382 character. | |
383 formfeed:y When a form feed character is encountered, continue | |
384 printing of the current line at the beginning of the | |
385 first line on a new page. | |
386 | |
387 The item indicated with (default) is used when the item is not present. The | |
388 values are not always used, especially when using a dialog to select the | |
389 printer and options. | |
390 Example: > | |
391 :set printoptions=paper:letter,duplex:off | |
392 | |
393 ============================================================================== | |
394 3. PostScript Printing *postscript-printing* | |
395 *E455* *E456* *E457* *E624* | |
396 Provided you have enough disk space there should be no problems generating a | |
397 PostScript file. You need to have the runtime files correctly installed (if | |
398 you can find the help files, they probably are). | |
399 | |
400 There are currently a number of limitations with PostScript printing: | |
401 | |
402 - 'printfont' - The font name is ignored (the Courier family is always used - | |
403 it should be available on all PostScript printers) but the font size is | |
404 used. | |
405 | |
406 - 'printoptions' - The duplex setting is used when generating PostScript | |
407 output, but it is up to the printer to take notice of the setting. If the | |
408 printer does not support duplex printing then it should be silently ignored. | |
409 Some printers, however, don't print at all. | |
410 | |
411 - 8-bit support - While a number of 8-bit print character encodings are | |
412 supported it is possible that some characters will not print. Whether a | |
413 character will print depends on the font in the printer knowing the | |
414 character. Missing characters will be replaced with an upside down question | |
415 mark, or a space if that character is also not known by the font. It may be | |
416 possible to get all the characters in an encoding to print by installing a | |
417 new version of the Courier font family. | |
418 | |
419 - Multi-byte support - Currently VIM will try to convert multi-byte characters | |
420 to the 8-bit encoding specified by 'printencoding' (or latin1 if it is | |
421 empty). Any characters that are not successfully converted are shown as | |
422 unknown characters. Printing will fail if VIM cannot convert the multi-byte | |
423 to the 8-bit encoding. | |
424 | |
425 ============================================================================== | |
426 4. Custom 8-bit Print Character Encodings *postscript-print-encoding* | |
427 *E618* *E619* | |
428 To use your own print character encoding when printing 8-bit character data | |
429 you need to define your own PostScript font encoding vector. Details on how | |
430 to define a font encoding vector is beyond the scope of this help file, but | |
431 you can find details in the PostScript Language Reference Manual, 3rd Edition, | |
432 published by Addison-Wesley and available in PDF form at | |
433 http://www.adobe.com/. The following describes what you need to do for VIM to | |
434 locate and use your print character encoding. | |
435 | |
436 i. Decide on a unique name for your encoding vector, one that does not clash | |
437 with any of the recognized or standard encoding names that VIM uses (see | |
438 |encoding-names| for a list), and that no one else is likely to use. | |
439 ii. Copy $VIMRUNTIME/print/latin1.ps to the print subdirectory in your | |
440 'runtimepath' and rename it with your unique name. | |
441 iii. Edit your renamed copy of latin1.ps, replacing all occurrences of latin1 | |
442 with your unique name (don't forget the line starting %%Title:), and | |
443 modify the array of glyph names to define your new encoding vector. The | |
444 array must have exactly 256 entries or you will not be able to print! | |
445 iv. Within VIM, set 'printencoding' to your unique encoding name and then | |
446 print your file. VIM will now use your custom print character encoding. | |
447 | |
448 VIM will report an error with the resource file if you change the order or | |
449 content of the first 3 lines, other than the name of the encoding on the line | |
450 starting %%Title: or the version number on the line starting %%Version:. | |
451 | |
452 [Technical explanation for those that know PostScript - VIM looks for a file | |
453 with the same name as the encoding it will use when printing. The file | |
454 defines a new PostScript Encoding resource called /VIM-name, where name is the | |
455 print character encoding VIM will use.] | |
456 | |
457 ============================================================================== | |
458 5. PostScript CJK Printing *postscript-cjk-printing* | |
459 *E673* *E674* *E675* | |
460 | |
461 VIM supports printing of Chinese, Japanese, and Korean files. Setting up VIM | |
462 to correctly print CJK files requires setting up a few more options. | |
463 | |
464 Each of these countries has many standard character sets and encodings which | |
465 require that both be specified when printing. In addition, CJK fonts normally | |
466 do not have the concept of italic glyphs and use different weight or stroke | |
467 style to achieve emphasis when printing. This in turn requires a different | |
468 approach to specifying fonts to use when printing. | |
469 | |
470 The encoding and character set are specified with the 'printencoding' and | |
471 'printmbcharset' options. If 'printencoding' is not specified then 'encoding' | |
472 is used as normal. If 'printencoding' is specified then characters will be | |
473 translated to this encoding for printing. You should ensure that the encoding | |
474 is compatible with the character set needed for the file contents or some | |
475 characters may not appear when printed. | |
476 | |
477 The fonts to use for CJK printing are specified with 'printmbfont'. This | |
478 option allows you to specify different fonts to use when printing characters | |
479 which are syntax highlighted with the font styles normal, italic, bold and | |
480 bold-italic. | |
481 | |
482 No CJK fonts are supplied with VIM. There are some free Korean, Japanese, and | |
483 Traditional Chinese fonts available at: | |
484 | |
485 http://examples.oreilly.com/cjkvinfo/adobe/samples/ | |
486 | |
487 You can find descriptions of the various fonts in the read me file at | |
488 | |
489 http://examples.oreilly.com/cjkvinfo/adobe/00README | |
490 | |
491 Please read your printer documentation on how to install new fonts. | |
492 | |
493 CJK fonts can be large containing several thousand glyphs, and it is not | |
494 uncommon to find that they only contain a subset of a national standard. It | |
495 is not unusual to find the fonts to not include characters for codes in the | |
496 ASCII code range. If you find half-width Roman characters are not appearing | |
497 in your printout then you should configure VIM to use the Courier font the | |
498 half-width ASCII characters with 'printmbfont'. If your font does not include | |
499 other characters then you will need to find another font that does. | |
500 | |
501 Another issue with ASCII characters, is that the various national character | |
502 sets specify a couple of different glyphs in the ASCII code range. If you | |
503 print ASCII text using the national character set you may see some unexpected | |
504 characters. If you want true ASCII code printing then you need to configure | |
505 VIM to output ASCII characters for the ASCII code range with 'printmbfont'. | |
506 | |
507 It is possible to define your own multi-byte character set although this | |
508 should not be attempted lightly. A discussion on the process if beyond the | |
509 scope of these help files. You can find details on CMap (character map) files | |
510 in the document 'Adobe CMap and CIDFont Files Specification, Version 1.0', | |
511 available from http://www.adobe.com as a PDF file. | |
512 | |
513 ============================================================================== | |
514 6. PostScript Printing Troubleshooting *postscript-print-trouble* | |
515 *E621* | |
516 Usually the only sign of a problem when printing with PostScript is that your | |
517 printout does not appear. If you are lucky you may get a printed page that | |
518 tells you the PostScript operator that generated the error that prevented the | |
519 print job completing. | |
520 | |
521 There are a number of possible causes as to why the printing may have failed: | |
522 | |
523 - Wrong version of the prolog resource file. The prolog resource file | |
524 contains some PostScript that VIM needs to be able to print. Each version | |
525 of VIM needs one particular version. Make sure you have correctly installed | |
526 the runtime files, and don't have any old versions of a file called prolog | |
527 in the print directory in your 'runtimepath' directory. | |
528 | |
529 - Paper size. Some PostScript printers will abort printing a file if they do | |
530 not support the requested paper size. By default VIM uses A4 paper. Find | |
531 out what size paper your printer normally uses and set the appropriate paper | |
532 size with 'printoptions'. If you cannot find the name of the paper used, | |
533 measure a sheet and compare it with the table of supported paper sizes listed | |
534 for 'printoptions', using the paper that is closest in both width AND height. | |
535 Note: The dimensions of actual paper may vary slightly from the ones listed. | |
536 If there is no paper listed close enough, then you may want to try psresize | |
537 from PSUtils, discussed below. | |
538 | |
539 - Two-sided printing (duplex). Normally a PostScript printer that does not | |
540 support two-sided printing will ignore any request to do it. However, some | |
541 printers may abort the job altogether. Try printing with duplex turned off. | |
542 Note: Duplex prints can be achieved manually using PS utils - see below. | |
543 | |
544 - Collated printing. As with Duplex printing, most PostScript printers that | |
545 do not support collating printouts will ignore a request to do so. Some may | |
546 not. Try printing with collation turned off. | |
547 | |
548 - Syntax highlighting. Some print management code may prevent the generated | |
549 PostScript file from being printed on a black and white printer when syntax | |
550 highlighting is turned on, even if solid black is the only color used. Try | |
551 printing with syntax highlighting turned off. | |
552 | |
553 A safe printoptions setting to try is: > | |
554 | |
555 :set printoptions=paper:A4,duplex:off,collate:n,syntax:n | |
556 | |
557 Replace "A4" with the paper size that best matches your printer paper. | |
558 | |
559 ============================================================================== | |
560 7. PostScript Utilities *postscript-print-util* | |
561 | |
562 7.1 Ghostscript | |
563 | |
564 Ghostscript is a PostScript and PDF interpreter that can be used to display | |
565 and print on non-PostScript printers PostScript and PDF files. It can also | |
566 generate PDF files from PostScript. | |
567 | |
568 Ghostscript will run on a wide variety of platforms. | |
569 | |
570 There are three available versions: | |
571 | |
572 - AFPL Ghostscript (formerly Aladdin Ghostscript) which is free for | |
573 non-commercial use. It can be obtained from: | |
574 | |
575 http://www.cs.wisc.edu/~ghost/ | |
576 | |
577 - GNU Ghostscript which is available under the GNU General Public License. It | |
578 can be obtained from: | |
579 | |
580 ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/gnu/ | |
581 | |
582 - A commercial version for inclusion in commercial products. | |
583 | |
584 Additional information on Ghostscript can also be found at: | |
585 | |
586 http://www.ghostscript.com/ | |
587 | |
588 Support for a number of non PostScript printers is provided in the | |
589 distribution as standard, but if you cannot find support for your printer | |
590 check the Ghostscript site for other printers not included by default. | |
591 | |
592 | |
593 7.2 Ghostscript Previewers. | |
594 | |
595 The interface to Ghostscript is very primitive so a number of graphical front | |
596 ends have been created. These allow easier PostScript file selection, | |
597 previewing at different zoom levels, and printing. Check supplied | |
598 documentation for full details. | |
599 | |
600 X11 | |
601 | |
602 - Ghostview. Obtainable from: | |
603 | |
604 http://www.cs.wisc.edu/~ghost/gv/ | |
605 | |
606 - gv. Derived from Ghostview. Obtainable from: | |
607 | |
608 http://wwwthep.physik.uni-mainz.de/~plass/gv/ | |
609 | |
610 Copies (possibly not the most recent) can be found at: | |
611 | |
612 http://www.cs.wisc.edu/~ghost/gv/ | |
613 | |
614 OpenVMS | |
615 | |
616 - Is apparently supported in the main code now (untested). See: | |
617 | |
618 http://wwwthep.physik.uni-mainz.de/~plass/gv/ | |
619 | |
620 Windows and OS/2 | |
621 | |
622 - GSview. Obtainable from: | |
623 | |
624 http://www.cs.wisc.edu/~ghost/gsview/ | |
625 | |
626 DOS | |
627 | |
628 - ps_view. Obtainable from: | |
629 | |
630 ftp://ftp.pg.gda.pl/pub/TeX/support/ps_view/ | |
631 ftp://ftp.dante.de/tex-archive/support/ps_view/ | |
632 | |
633 Linux | |
634 | |
635 - GSview. Linux version of the popular Windows and OS/2 previewer. | |
636 Obtainable from: | |
637 | |
638 http://www.cs.wisc.edu/~ghost/gsview/ | |
639 | |
640 - BMV. Different from Ghostview and gv in that it doesn't use X but svgalib. | |
641 Obtainable from: | |
642 | |
643 ftp://sunsite.unc.edu/pub/Linux/apps/graphics/viewers/svga/bmv-1.2.tgz | |
644 | |
645 | |
646 7.3 PSUtils | |
647 | |
648 PSUtils is a collection of utility programs for manipulating PostScript | |
649 documents. Binary distributions are available for many platforms, as well as | |
650 the full source. PSUtils can be found at: | |
651 | |
652 http://knackered.org/angus/psutils | |
653 | |
654 The utilities of interest include: | |
655 | |
656 - psnup. Convert PS files for N-up printing. | |
657 - psselect. Select page range and order of printing. | |
658 - psresize. Change the page size. | |
659 - psbook. Reorder and lay out pages ready for making a book. | |
660 | |
661 The output of one program can be used as the input to the next, allowing for | |
662 complex print document creation. | |
663 | |
664 | |
665 N-UP PRINTING | |
666 | |
667 The psnup utility takes an existing PostScript file generated from VIM and | |
668 convert it to an n-up version. The simplest way to create a 2-up printout is | |
669 to first create a PostScript file with: > | |
670 | |
671 :hardcopy > test.ps | |
672 | |
673 Then on your command line execute: > | |
674 | |
675 psnup -n 2 test.ps final.ps | |
676 | |
677 Note: You may get warnings from some Ghostscript previewers for files produced | |
678 by psnup - these may safely be ignored. | |
679 | |
680 Finally print the file final.ps to your PostScript printer with your | |
681 platform's print command. (You will need to delete the two PostScript files | |
682 afterwards yourself.) 'printexpr' could be modified to perform this extra | |
683 step before printing. | |
684 | |
685 | |
686 ALTERNATE DUPLEX PRINTING | |
687 | |
688 It is possible to achieve a poor man's version of duplex printing using the PS | |
689 utility psselect. This utility has options -e and -o for printing just the | |
690 even or odd pages of a PS file respectively. | |
691 | |
692 First generate a PS file with the 'hardcopy' command, then generate a new | |
693 files with all the odd and even numbered pages with: > | |
694 | |
695 psselect -o test.ps odd.ps | |
696 psselect -e test.ps even.ps | |
697 | |
698 Next print odd.ps with your platform's normal print command. Then take the | |
699 print output, turn it over and place it back in the paper feeder. Now print | |
700 even.ps with your platform's print command. All the even pages should now | |
701 appear on the back of the odd pages. | |
702 | |
703 There a couple of points to bear in mind: | |
704 | |
705 1. Position of the first page. If the first page is on top of the printout | |
706 when printing the odd pages then you need to reverse the order that the odd | |
707 pages are printed. This can be done with the -r option to psselect. This | |
708 will ensure page 2 is printed on the back of page 1. | |
709 Note: it is better to reverse the odd numbered pages rather than the even | |
710 numbered in case there are an odd number of pages in the original PS file. | |
711 | |
712 2. Paper flipping. When turning over the paper with the odd pages printed on | |
713 them you may have to either flip them horizontally (along the long edge) or | |
714 vertically (along the short edge), as well as possibly rotating them 180 | |
715 degrees. All this depends on the printer - it will be more obvious for | |
716 desktop ink jets than for small office laser printers where the paper path | |
717 is hidden from view. | |
718 | |
719 | |
720 ============================================================================== | |
721 8. Formfeed Characters *printing-formfeed* | |
722 | |
723 By default VIM does not do any special processing of |formfeed| control | |
724 characters. Setting the 'printoptions' formfeed item will make VIM recognize | |
725 formfeed characters and continue printing the current line at the beginning | |
726 of the first line on a new page. The use of formfeed characters provides | |
727 rudimentary print control but there are certain things to be aware of. | |
728 | |
729 VIM will always start printing a line (including a line number if enabled) | |
730 containing a formfeed character, even if it is the first character on the | |
731 line. This means if a line starting with a formfeed character is the first | |
732 line of a page then VIM will print a blank page. | |
733 | |
734 Since the line number is printed at the start of printing the line containing | |
735 the formfeed character, the remainder of the line printed on the new page | |
736 will not have a line number printed for it (in the same way as the wrapped | |
737 lines of a long line when wrap in 'printoptions' is enabled). | |
738 | |
739 If the formfeed character is the last character on a line, then printing will | |
740 continue on the second line of the new page, not the first. This is due to | |
741 VIM processing the end of the line after the formfeed character and moving | |
742 down a line to continue printing. | |
743 | |
744 Due to the points made above it is recommended that when formfeed character | |
745 processing is enabled, printing of line numbers is disabled, and that form | |
746 feed characters are not the last character on a line. Even then you may need | |
747 to adjust the number of lines before a formfeed character to prevent | |
748 accidental blank pages. | |
749 | |
750 ============================================================================== | |
751 vim:tw=78:ts=8:ft=help:norl: |