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