MozillaZine

PostScript Module

From MozillaZine Knowledge Base

The PostScript module is one of two subsystems used to support printing on unix, linux, VMS, and similar operating systems; the other is Xprint. This module is based on the printing support from Netscape Communicator 4.x and older versions.

The PostScript module (or PS for short) operates by writing a PostScript document for the print job to a temporary file. This file may then be submitted for printing through lpr or another program, or it can be saved to a permanent filename.

Contents

Printer selection

By default, the PS module sets up one print destination, called PostScript/default. Additional printers may be added through one of three methods:

  • If CUPS is installed on the system, then PS will query CUPS for a list of printers. These will appear in the print dialog as CUPS/<name>.
  • PS will check for an environment variable MOZILLA_POSTSCRIPT_PRINTER_LIST. If set, it's interpreted as a space-separated list of printers. In the print dialog these will appear as PostScript/<name>.
  • If MOZILLA_POSTSCRIPT_PRINTER_LIST was not set, then PS will check for a pref print.printer_list. If found, it's handled the same way as MOZILLA_POSTSCRIPT_PRINTER_LIST.

Printing to a CUPS printer

When printing to a CUPS printer (any printer labelled with CUPS in the print dialog), gecko uses the CUPS library to submit print jobs.

  • At the time the PostScript is generated, the printable area of the printer may not be known (see bug 130075). The default distance of headers and footers is 0.04 inch from the paper margin, frequently resulting in headers and footers not visible when printed. Note that this is different from the margins set in the general Page Setup page.
  • To resolve this, go into the Print dialog and click on "Properties". There you should find a set of four fields "Gap from edge of paper to Margin". If you know, for example, that your printer cannot print on the outermost 0.25 inch, set those values to 0.25 to ensure that the headers and footers are printed within the visible area.

Printing to other printers

For printers labelled PostScript in the print dialog (and not on VMS; see below), gecko follows these steps to print:

  1. If not printing to PostScript/Default, create an environment variable MOZ_PRINTER_NAME containing the name of the printer.
  2. Launch the print command with its standard input connected to a pipe. The command comes from the printer properties dialog. On Solaris the default command is lp -c -s ${MOZ_PRINTER_NAME:+'-d '}${MOZ_PRINTER_NAME}; on other systems it's lpr ${MOZ_PRINTER_NAME:+'-P'}${MOZ_PRINTER_NAME}.
  3. Write the text of the print job to the pipe connected to the print command.

Printing on OpenVMS

On VMS, gecko follows these steps to print:

  1. Write the print job to a temporary file.
  2. If not printing to PostScript/Default, create an environment variable MOZ_PRINTER_NAME containing the name of the printer.
  3. Run a command to submit the file for printing. The actual command comes from the printer properties dialog, with the name of the file appended. By default, gecko runs print /delete <name-of-file>.

Printing on VMS is currently broken in gecko 1.8; see bug 246349. Patches are welcome.