How to print booklets and save paper

The basic commands from psutils package to print booklets from a postcript file file.ps are:
  psbook file.ps B.ps
  psnup -2 B.ps 2.ps
  pstops "2:0@1.0(-0.00cm,0.0cm),1U@1.0(21cm,29.7cm)" 2.ps final.ps 
  lpr final.ps
  \rm B.ps 2.ps final.ps
The first command rearranges the pages of file.ps in the proper order. The second reduces its size: the area is divided by 2, but notice that dimensions are only divided by the square root of 2. The third line allows printing in landscape using a recto-verso printer, by inverting the orientation of every second page. As the margins are different for all files, it is better to adjust the margins for each file. The script psbind seems to be able to calculate these adjustments itself, and proves useful for quick and dirty print (use it instead of psnup -2), but I have not tested its options yet. The program psdim seems also interesting.

An example

Here is an example. Let us suppose you want to print the file http://www.math.uvsq.fr/~marckert/part2.ps.gz. Then you can use the following commands
  zcat part2.ps.gz |psbook>B.ps
(this avoids gunzipping the file),
  psnup -2 -m-30 -b-10 B.ps 2.ps
-m: adjusts external margins (with negative or positive values)
-b: adjusts all margins (both external and internal)
These two options are conflicting, so I suggest adjusting first the internal margins using -b, and then adjusting external margins using -m.
  pstops "2:0@1.0(-0.00cm,-0.2cm),1U@1.0(21cm,29.9cm)" 2.ps final.ps
As the options -m and -b of psnup are symmetrical, you may have to correct a remaining dissymetry. In the file above, I corrected a dissymetry in the y-axis. Of course you can do the same for the x-axis. Besides, as printers may print with dissymetries, you may want to correct them yourself using the pstops command: it is up to you to make experiments with your printer.

Remarks

  • option A4: Choose option A4 in ghostview when previewing.
  • margins: You can adjust all margins in a psnup-like command using the script ps21. Notice that this script makes use of pstops which must be present in your file system.
  • uncompliant ps: Though most postscript files are compliant, some may be not be handled by psutils programs. A few perl scripts also present in psutils package can cope with a few of them, to make the files more or less compliant. These scripts might not be present in your platform but they can be downloaded separately. A script of great use is for example fixwfwps.pl which can fix postscript files created by Windows Word like http://www.lpthe.jussieu.fr/DEA/pottier.ps.gz.
  • mpage: (paragraph still under construction) There exists an equivalent of psnup called mpage ( man mpage ) which may be present in your platform. Notice that you cannot feed an mpage output file to mpage itself or to psutils. I have not tested mpage landscape mode yet. (At the LIX, there exists a printer already configured to print in landscape mode). Notice that mpage allows to correct the four margins independently. There also seems to exist a script form which seems to be different from the program and that I have not tested for printing.
  • For one-sided printers, diverse other techniques can be found at The Linux Cookbook: Tips and Techniques for Everyday Use - PostScript . If you have a one-sided printer, you can use the following guidelines to print booklets: http://www.dsl.org/cookbook/cookbook_25.html#SEC371.
  • The inverse command of psnup -2 is pstops "1:0@1.44R(-0.00cm,29.7cm),0@1.44R(-21cm,29.7cm)".
  • Descend order: Sometimes, for face-down printers, pages in the postscript file, such as in Andrew Odlzko's or Donatella Merlini's papers, are in the reversed order, though you cannot see it with your favourite order, because it is told that the pages are in descend order. Commands to put them back in ascend order are pstops -0 or psselect -r.
  • No burst page: Use the command lpr -h to prevent the printer from printing the burst page.
  • Huge files: After conversions from different formats like pdf2ps, you may end with huge files. You can print them with the command lpr -s, to use the computer's memory instead of the printer's one. But then you have to wait for the printing to end before possibly erase the file.
  • One pass only! It is possible to do all the operations in one command line only, of the type
    pstops 4:-3L@.65\(8.0in,0\)+0L@.65\(8.0in,5.5in\),<snip>
    <snip>-2R@.65\(0.5in,5.5in\)+1R@.65\(0.5in,11in\) file.ps final.ps
    (remove the <snip>), but then controlling the margins is much more difficult.
  • Overlapping pages: When the pages are scaled with a positive factor, they might overlap on the other page. I do not know how to solve this problem, except that an Acrobat software in Windows might help (I did not have the time to try it). I met this phenomenon when I wanted to print the Newton's book Théorie des fluxions available at gallica.bnf.fr. Let us call the downloaded file file.pdf. I used the following commands:
      pdf2ps file.pdf newton.ps
      psbook newton.ps B.ps
      pstops "1:0@2(-10.3cm,-28cm)" B.ps C.ps
      psnup -2 -b10 -m-30 C.ps 2.ps
    
    and in the file 2.ps, the left part of the right A5 always overlap the left A5. (Some of these files can be of more than 200 Mo so do not try this example unless you have a powerful machine and memory enough!)

    Psutils package

    There exist various commands able to manipulate postscript files, belonging to the package psutils, present in most recent UNIX platforms, described at:
  • psutils - utilities for manipulating PostScript documents.
  • PSUtils - PostScript utilities.
    You can download files separately at Index of /sw/nlp/distrib/nlp-3.0.4/contrib/psutils.
    Send questions, comments and improvements at mnguyen@lix.polytechnique.fr
    URL originale de cette page: "> http://
    Created on July, 2nd 2002.
    Last modified: