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