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