.TH vpp 1 "July 10, 2025" "vpp version 3.10" "DekDoc scripts" .SH NAME vpp - View and (selectively) Print PDF and PostScript .SH Synopsis .B vpp [options] [file] Options: .B -h,--help .RS show a help message and exit .RE .B -H,--Help .RS show full documentation via less and exit .RE .B -V,--version .RS show version and exit .RE .B -b,--batch=X .RS run in batch using X as the print command .RE .B --view .RS view the document (this is the default) .RE .B --noview .RS do not view the document .RE .B --viewer=X .RS specifies X as the pdf viewer to use .RE .B --print .RS offer printing interaction (this is the default) .RE .B --noprint .RS do not offer printing interaction .RE .B -p,--printer=X .RS print the printer named X .RE .B -v,--verbose .RS be verbose, keeping intermediate files .RE .B --noverbose .RS don’t be verbose (this is the default) .RE .B -r,--rc=X .RS set rc file to X, must be the first option! .RE .RS without the argument: don't read any rc-file .RE Arguments for short options are given without a separator, so you can write either --rc=myrc or -rmyrc. .SH Description vpp is a Bash script designed to display PDF or PostScript documents (after converting them to PDF). Users can utilize the viewer to print the document directly or exit the viewer and use vpp's features to print selected pages as a single-sided or double-sided hardcopy, or as an A5 booklet. For more details, refer to the section titled "Page selection and other commands". Additionally, instead of printing, users can save their selections as PDF files. If file is specified with a .ps or .pdf extension, vpp will directly use that file. Otherwise, vpp will search for file.pdf, file.ps, and file in that order, and will use the first existing file it finds. If no file is specified, vpp will read from standard input. In all cases, the file type (PDF or PostScript) is determined by examining the first few characters of the file. vpp requires both a viewer and a printer to function. For more information, see the section "Printers and viewers". .SH Exit value vpp has four possible exit values: .B 0 .RS OK .RE .B 1 .RS error .RE .B 2 .RS edit, which is a signal to the calling program that a new .RE .RS edit session is at order; this is used by mk. .RE .B 3 .RS re-compile; this is used by mk .RE .SH Dependencies .B pdfinfo .RS from poppler-utils .RE .B ps2pdf .RS from ghostscript .RE .B getopt .RS from util-linux .RE .B lpoptions .RS from cups-client .RE .B lpstat .RS from cups-client .RE .B texlog_extract .RS from texlive .RE .SH Printers and viewers For the operation of vpp, availability of printers and pdf viewers is important. Therefore, two associative arrays are defined: .B printers .RS an array available printers, where the keys are printer names .RE .B viewers .RS an array of available viewers, where the keys are viewer names .RE .RS and the values are the corresponding commands, with arguments if any. .RE For each array, an index is set: printer for the printers array. viewer for the viewers array. printer points to the current printer, viewer to the current viewer. You can inspect the contents of these arrays either with the short help option (-h or --help) or, when you are in vpp's command mode, with the ? command. The printers array is automatically filled, using the lpstat and lpoptions commands. The viewers array can be set in several ways: .IP ‣ 2 It is initially set to: viewers=([xp]=xpdf [ev]=evince [gv]=gv [ac]=acroread) but after that, unavailable viewers are silently removed. This may result in an empty list. .IP ‣ 2 After this, an rc file may be available, either in the form of ~/.vpprc or specified with the --rc option. .IP ‣ 2 the --viewer option may specify a viewer. .IP ‣ 2 Finally, a viewer may be specified on-the-fly, with the v command (see the section on \fIPage selection and other commands\fR. .PP .SH Options vpp comes with several options. Before evaluating any options, vpp will try to read the user rc-file, ~/.vpprc, where you can set defaults for most options, by assigning values to variable named after the long form of the options. For example, there are three ways to select the printer named \fIk550\fR: .IP ‣ 2 use the option --printer=k550. .IP ‣ 2 enter a line with printer=k550 in your rc file (~/.vpprc, for example). .IP ‣ 2 in command mode, enter pk550. .PP These are the variables that can be set in ~/.vpprc: .B batch .RS (string) sets the --batch option .RE .B print .RS (true or false) sets printing interaction on or off .RE .B printer .RS (string) sets the --printer option .RE .B verbose .RS (true or false) sets the --verbose option .RE .B view .RS (true or false) sets viewing on or off .RE .B viewer .RS (string) set the viewer; arguments may be added; example: .RE .RS .B viewer='acroread -geometry 1450x1150+0+0' .RE .RS You should use a basename here, that is: the name of the viewer should contain no slashes, and it should be in your PATH. .RE .B --help .RS Prints synopsis and available printers and viewers, then quits. .RE .B --Help .RS Prints this documentation, \fIvia\fR less. .RE .B --version .RS Prints version, then quits. .RE .B --verbose .RS Prints messages about the progress vpp is making. Can be reverted with --noverbose. .RE .B --rc=X .RS Read the specified X, instead of the default rc-file, ~/.vpprc. If this option is used, it must be used before any other options. If rc-file is an empty string, no rc-file will be read, thus skipping reading of ~/.vpprc. .RE --batch=X Prevents the --print option to interrogate the user about pages to be printed. Instead the document is printed according to the commands in the mandatory X. Also sets viewing off. Thus the command vpp --batch '2-3 x3' test.pdf prints 3 copies of pages 2 and 3 of |test.pdf| without interaction .B --print .RS Present the print prompt. This is the default. Can be reverted with --noprint, normally used to suppress the print prompt, for example when using vpp from other scripts that generate PDF or PostScript documents that have only to be displayed or printed without even being displayed. .RE .B --view .RS Run the file viewer. This is the default. Can be reverted with --noview, normally used to suppress starting the viewer, for example when using vpp from other scripts that generate PDF or PostScript documents that have only to be printed. .RE .B --printer=X .RS Specifies the printer X to be used instead of the system default printer. See the section \fIPrinters and viewers\fR for more information. .RE .B --viewer=X .RS Specifies the viewer to use. This script defines an associative array viewers containing 4 viewers as follows: .RE .RS .B viewers=([xp]=xpdf [ev]=evince [gv]=gv [ac]=acroread) .RE .RS and the viewer is set to xp by default. However, you can define your own set of viewers in the ~/.vpprc file or in any rc file given with the --rc option. For example: .RE .RS .B viewers=( .RE .RS .B [xp]='xpdf -g 970x1050+0+0 -font 8x13bold -z page -cont' .RE .RS .B [ac]='acroread -geometry 850x890+0+0' .RE .RS .B [ev]='evince --fullscreen --presentation' .RE .RS .B ) .RE .RS .B viewer=xp .SH Page selection and other commands When you select the --print option, and you did not also use the --batch option, vpp interrogates you about the pages you want to print. To that end the following prompt appears: vpp command (? for help): upon typing ? or h, vpp displays examples of possible commands: Command Examples: 5 to print page 5 5- to print pages 5 through the end 5-7 to print pages 5, 6 and 7 7-5 ox write the same pages, in reversed order, to x.pdf -7 to print the first 7 pages 5-7 19- to print pages 5, 6, 7 and 19 through the end a to print the whole document - to print the whole document a x3 to print 3 copies of the document x3 the same 5 x3 to print 3 copies of page 5 s print the whole document single-sided s 2- print single-sided starting at page 2 b to print the whole document as an a5 size booklet b -12 to print the first 12 pages as an a5 size booklet Other commands: e (if called by mk) edit the tex source and rerun mk c (if called by mk) rerun mk v (re)view the ps/pdf file or, with an argument, specify a viewer. w list errors and warnings from the log file oxyz send pdf output to file xyz.pdf instead of printer pxyz print to printer xyz h display this help ? display this help q quit Sub-commands are separated with spaces or commas, so you can write either 5-7␣19␣ox or 5-7,19␣ox or 5-7,19,ox see the section \fIExamples\fR. With these descriptions, no further explanation should be necessary, except for the following: Unless single-sided printing is selected with the s command, when the selected printer is a non-duplex printer, printing will be performed in two shifts, one for the front side and one for the back side. Between the shifts, another prompt appears: printer ready? then turn pack over the long side and type enter (^D skips) You will have to arrange your printer such that, with the printed sides up, the first page printed will be at the bottom of the stack, and the last page printed will be on top. Normally you will then have your output come out the front of your printer. Rotate it over the long side of the paper and feed it back into the printer for the other side to be printed. When you use the oxyz subcommand, your selection will not be printed but instead will be saved in a PDF file named xyz.pdf. When you use a t or b selection, you will not, of course, be prompted to turn the paper stack. Instead, the odd and even pages of your selection will be saved in separate PDF files, xyz_odd.pdf and xyz_even.pdf. .SH Environment Two environment variables may be useful in scripts using vpp: .B VPPOUTDIR .RS The directory where PDF files generated with the o command will .RE .RS be saved; the default is the working directory. .RE .B VPPCHECKSAVED .RS If non-empty, vpp will check on exit that the inspected file .RE has been saved into a pdf file and will issue a warning if it hasn’t. Useful if input is from standard input or a temporary file. .SH Examples Since vpp can read from standard input, it can be used to print (parts of) manpages. This example (we assume a printer which cannot print double-sided) prints the full ls manpage first, followed by an A5 booklet of the first 8 pages: $ man -t ls | vpp # (shows preview and is left with q) vpp command (? for help): a vpp command (? for help): b 1-8 printer ready? then turn pack over the long side and type enter (^D skips) vpp command (? for help): q $ If you don’t need a preview, because you have seen the man page already, you can print it immediately as an A5 booklet with: $ man -t ls | vpp --batch=b or, to make an A5 booklet of the first 8 pages: $ man -t ls |vpp --batch='-8 b' If you just want to save a PDF copy of the man page in ls.pdf, you can say: $ man -t ls |vpp -bols Some PDF-documents, like the CVS manual (cvs.pdf), have their table of contents in their back instead of behind the title page. You can use vpp to rearrange such documents: $ vpp --batch='1 2 153-160 3-152 ocvs' cvs.pdf This overwrites the input document. Note that any links in the file will get broken, so that is only useful for documents that have to be printed. It would have been more sensible in this case to say: $ vpp --batch=b,1,2,153-160,3-152 cvs which prints the reordered document as an A5 booklet without replacing it. Note that we used comma's instead of spaces here, so we didn't need to quote the string. You can even print or output page ranges in reverse order: $ vpp --batch='12-1 otest' cvs.pdf .SH Author Wybo Dekker (wybodekker@me.com) .SH Copyright Released under the GNU General Public License (www.gnu.org\fIcopyleft\fRgpl.html)