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