Tag: duplex
Printing multi-page duplex documents
by Mostafa on Oct.18, 2009, under How To ..., Linux, Software
The psnup tool can be used to place multiple pages on each sheet of a document. E.g., the following command places two pages from the input file into each sheet of the output:
$ psnup -l -2 input.ps output.ps
While psnup is excellent for quick “N-up” conversion jobs, it doesn’t provide much control over the layout. The pstops utility on the other hand allows for fine grained scale, rotation and placement settings for each page that goes into a sheet of the output. The command syntax is a bit more complicated on account of the page specification strings that must now be provided. The following example shows a typical command needed to prepare a document for duplex printing with two pages on each side of a sheet:
$ pstops -pa4 \ '4:0L@0.8(21cm,-1cm)+1L@0.8(21cm,12.55cm),2R@0.8(0,29.85cm)+3R@0.8(0,16.25cm)' \ input.ps output.ps
The command is best understood by referring to the relevant section from the manpage:
Pstops rearranges pages from a PostScript document, creating a new PostScript file. The input PostScript file should follow the Adobe Document Structuring Conventions. Pstops can be used to perform a large number of arbitrary re-arrangements of Documents, including arranging for printing 2-up, 4-up, booklets, reversing, selecting front or back sides of documents, scaling, etc. pagespecs follow the syntax: pagespecs = [modulo:]specs specs = spec[+specs][,specs] spec = [-]pageno[L][R][U][@scale][(xoff,yoff)] modulo is the number of pages in each block. The value of modulo should be greater than 0; the default value is 1. specs are the page specifi- cations for the pages in each block. The value of the pageno in each spec should be between 0 (for the first page in the block) and modulo-1 (for the last page in each block) inclusive. The optional dimensions xoff and yoff shift the page by the specified amount. xoff and yoff are in PostScript’s points, but may be followed by the units cm or in to convert to centimetres or inches, or the flag w or h to specify as a multiple of the width or height. The optional parameters L, R, and U rotate the page left, right, or upside-down. The optional scale param- eter scales the page by the fraction specified. If the optional minus sign is specified, the page is relative to the end of the document, instead of the start. If page specs are separated by + the pages will be merged into one page; if they are separated by they will be on separate pages. If there is only one page specification, with pageno zero, the pageno may be omitted. The shift, rotation, and scaling are performed in that order regardless of which order they appear on the command line.