Appendix I. Impressario PPD Driver Implementation
Prev |  | Next

## Appendix I. Impressario PPD Driver Implementation

This appendix documents the Impressario PPD driver available with Impressario 2.2 (and higher).

These are the major topics discussed in this appendix:

- “About PPD Files”

- “Adding a PPD File to the System”

- “Customizing a PPD File”

- “PPD Driver Files”

- “What Happens When a PPD Driver Is Installed”

- “Where to Find PPD Files for a Specific Printer”

- “Applicable Reference Pages”

## About PPD Files

PostScript Printer Description (PPD) files are human-readable text files that describe the features of a specific PostScript capable printer. A PPD file describes printer features in such a way that a graphical user interface (GUI) can be built to present the user with a list of printer features to choose from. Examples of printer features include paper size, supported fonts, paper handling, and so on. A PPD file also contains PostScript and Job Control Language (JCL) commands to be used to invoke the selected features.

The Impressario PPD software parses a PPD file and uses the PPD file information to

- build a list of supported printers (Printer Manager Add function)

- build a GUI for controlling the printer (glp Options panels)

- send the correct PostScript and JCL commands to the printer (the Impressario PPD printer driver)

For more information on PPD files, see the document PostScript Printer Description File Format Specification, available from Adobe Systems Incorporated. Version 4.2 of the document was used as the basis of the Impressario PPD driver.

## Adding a PPD File to the System

The simplest way to add a PPD file is to copy the PPD file to the `/var/spool/lp/PPD_model` directory. A few rules should be followed:

- The PPD filename must end with .`ppd`.

- Many PPD files contain DOS file formats. The PPD file should be converted to a UNIX file format. Use the following commands, substituting the name of the specific PPD file for <ppd_filename>:

      to_unix <ppd_filename> temp.ppd
      mv temp.ppd <ppd_filename>

- The PPD file ownership and permissions should be set correctly. Use the following commands, substituting the name of the specific PPD file for <ppd_filename>:

      chown lp.lp <ppd_filename>
      chmod 644 <ppd_filename>

- The PPD file should be human-readable (that is, the PPD file should not be compressed or encrypted in any manner). Use the following command to verify that the file is readable:

      more <ppd_filename>

Once the file is in the `/var/spool/lp/PPD_model` directory, the Printer Manager will list the printer that the PPD supports.

| Note: If the Printer Manager is running and a new PPD file is added to `/var/spool/lp/PPD_model`, then the Printer Manager should be restarted to ensure that the new PPD file is seen.

## Customizing a PPD File

This section contains a list of files that can be used to customize a PPD driver, along with a description of their functions.

- `/var/spool/lp/PPD_model/<ppd_filename>.ppd`

  This is the basic PPD file supplied by the printer vendor. As a minimum, this is the only file that is actually needed to support a PPD driver.

- `/var/spool/lp/PPD_model/<ppd_filename>.extension.ppd`

  Additional PPD commands for the GUI are contained in this file. It allows the GUI options to be extended beyond those found in a PPD file supplied by the printer vendor. This file is optional. If it is not present, one of the following three files is used (see “PPD Driver Files” for a description of their functionality):

  - `/var/spool/lp/PPD_model/impressario_ppd_common.ppd`

  - `/var/spool/lp/PPD_model/impressario_ppd_common_3color.ppd`

  - `/var/spool/lp/PPD_model/impressario_ppd_common_4color.ppd`

    These files can be used as the basis of a custom interface. Rename the file you wish to use as `/var/spool/lp/PPD_model/<ppd_filename>.extension.ppd`.

    Using this naming scheme insures that the file is found by the PPD driver and used in the GUI. (The customized file has to be created before the printer is installed. It is really the printer installation process that “finds” and uses the file.)

    | Note: This file is used only for extending GUI options panel. It cannot be used to set up commands to be sent to the printer. If any new options are added to the file, an updated `/var/spool/lp/model/<ppd_name>_impressario_ppd_model` file will be needed to correctly parse the customized options (see the next item and the `impressario_ppd_model(1)` reference page).

- `/var/spool/lp/model/<ppd_filename>_impressario_ppd_model`

  By default, the PPD driver uses the file `/var/spool/lp/model/impressario_ppd_model` as the lp model file for the PPD driver. A custom model file can also be supplied. It is recommended that custom model files be based on the default model file (`/var/spool/lp/model/impressario_ppd_model`).

  `/var/spool/lp/model/loptrac_impressario_ppd_model` is an example of a modified model file for the Lexmark Optra C color laser printer. It has been updated to set up color management variables to apply color corrections specific to the Optra C. Use the following command to study the difference between it and the default PPD model file:

      cd /var/spool/lp/model
      gdiff impressario_ppd_model loptrac_impressario_ppd_model

  The name of the model file must end with `impressario_ppd_model`.

- `/usr/lib/X11/$LANG/app-defaults/ppd/<ppd_filename>`

  This file is an X resource file for a PPD file and typically contains GUI prompts and other information specific to the printer. This file is optional. The `/usr/lib/print/genppdtemplate` utility can be used to generate this file based on the PPD file contents. See the `genppdtemplate(1)` reference page.

  If this X resource file is not found, then the GUI prompts are taken from the `/var/spool/lp/PPD_model/<ppd_filename>.ppd` file. If the X resource file is found, then the contents of the resource file override the contents of the `/var/spool/lp/PPD_model/<ppd_filename>.ppd` file.

  This file can be used to create a language-specific GUI application. This is typically easier than modifying the `/var/spool/lp/PPD_model/<ppd_filename>` file with translated prompts, since a PPD file can not be easily changed without a strong knowledge of the PPD file format (trying to translate a PPD file will probably result in creating an invalid PPD file).

  This file is processed only when a printer is added. If an X resource file is created for an existing printer, then the printer manager should be used to remove and reinstall the printer to ensure that the new X resource file is used.

## PPD Driver Files

PPD files used by the PPD driver are as follows:

- `/var/spool/lp/PPD_model/<ppd_filename>`

  This is the basic PPD file. It contains the commands to prepend and postpend to the data stream to the printer. This file is typically written by the printer manufacturer.

- `/var/spool/lp/PPD_model/impressario_ppd_common.ppd`

- `/var/spool/lp/PPD_model/impressario_ppd_common_3color.ppd`

- `/var/spool/lp/PPD_model/impressario_ppd_common_4color.ppd`

  These three files implement a common section of the GUI options menu (common in that it is always seen on the PPD driver GUI). The PPD code for the “Basic Options,” “Text File Options,” and “Image File Options” portions of the GUI are found in these files. One of the above three files is automatically used based on the color model of the printer (RGB printers use `impressario_ppd_common_3color.ppd`; CMYK printers use `impressario_ppd_common_4color.ppd,` and monochrome printers use `impressario_ppd_common.ppd`).

  All of the above three files are ignored if a printer specific version is found using the name `/var/spool/lp/PPD_model/<ppd_filename>.extension.ppd`. See “Customizing a PPD File” for details.

  Note that these PPD files have six new extended PPD “*OpenUI” GUI types that are not defined in the Adobe PPD specification. The types are as follows:

  - IntegerField

  - FloatField

  - IntegerScale

  - FloatScale

  - IntegerInterval

  - FloatInterval

  The following are two other new statements that may appear in the OpenUI...CloseUI construct:

  - `*Range <min1> <default1> <max1> [<min2> <default2> <max2>]`

  - `*Tags <tag1> [<tag2>]`

  These are Silicon Graphics extensions to the PPD GUI interface.

### LP Model Files

- `/var/spool/lp/model/impressario_ppd_mode`l

  This is the default lp spooler model file used by the PPD driver. It is ignored if the following file is available.

- `/var/spool/lp/model/<ppd_name>_impressario_ppd_model`

  See “Customizing a PPD File” for details.

### X Resource Files

All PPD X resources are found under either the `/usr/lib/X11/$LANG/app-defaults/ppd` or `/usr/lib/X11/app-defaults/ppd` directory.

- `/usr/lib/X11/$LANG/app-defaults/ppd/<ppd_filename>`

  This is a resource file for a PPD. It is generated from the PPD file using `genppdtemplate` (see the `genppdtemplate(1)` reference page for more details). This file is optional and is included with all Silicon Graphics supplied PPD files found in `/var/spool/lp/PPD_model`.

- `/usr/lib/X11/$LANG/app-defaults/ppd/SpecificPpdResources`

  This is an X resource file for the PPD GUI interface program (the program `/var/spool/lp/gui_model/ELF/impressario_ppd_model.gui` that uses this).

- `/usr/lib/X11/$LANG/app-defaults/ppd/GenericPpdResources`

  This is an X resource file for the following files:

  - `/var/spool/lp/PPD_model/impressario_ppd_common.ppd`

  - `/var/spool/lp/PPD_model/impressario_ppd_common_3color.ppd`

  - `/var/spool/lp/PPD_model/impressario_ppd_common_4color.ppd`

### GUI Driver

- `/var/spool/lp/gui_model/ELF/impressario_ppd_model.gui`

  This is the GUI binary for the PPD driver. It presents the users with various printer specific options. Normally a link is created from `/var/spool/lp/gui_interface/ELF/<printername>` to this file, or the binary is copied from a print server to a print client as `/var/spool/lp/gui_interface/ELF/<printername>`. The binary is compiled under IRIX 5.3 to support copying it to older Silicon Graphics systems when they are configured as a print client.

  | Note: The `impressario_ppd_model.gui` program unpacks the PPD and X resource files to be used from the file `/var/spool/lp/app-defaults/<printername>/PPD_PostScript` (which is created when the printer is installed). It does not look at any other configuration files. If you are customizing PPD or X resource files, you will need to remove and reinstall the printer (using the Printer Manager) to see the effects of any changes you have made.

### PPD Printer Filter

- `/usr/lib/print/ppd_driver`

  This file reads standard input (assumed to be a PostScript stream). It prepends and postpends the required PostScript and JCL commands to enable the printer features. The PostScript and JCL commands that do this are parsed from the printer's PPD file. See the `ppd_driver(1)` reference page for details.

  The output is normally sent to `/usr/lib/print/phandler` (parallel port driver) or `/usr/lib/print/nethandler` (network connected printer driver) for transmission to the printer.

### Created File

- `/var/spool/lp/app-defaults/<printername>/PPD_PostScript`

  This file is created when a printer is configured with the Printer manager. The file contains X resource files and PPD files. It is packed with PPD files and X resource files using the `/usr/lib/print/packppdfiles` utility. See the section “What Happens When a PPD Driver Is Installed” for details. Also see the `packppdfiles(1)` reference page.

  | Note: Once a printer is installed, all X resource files for the printer GUI options panel are taken from this file. If any new or language-specific resource files are installed, then the printer must be removed and reinstalled (using the printer manager) to ensure that the new resource files are used (do this on the print server first and then on the clients).

### Other Utility Files

- `/usr/lib/print/genppdtemplate`

  Used to generate an X resource file from a PPD file.

- `/usr/lib/print/ppdtopod`

  Used to convert a PPD file to an Impressario POD format. Invoked with the printer's PPD file when the printer is installed.

- `/usr/lib/print/packppdfiles`

  Used to pack several files into a single file (`/var/spool/lp/app-defaults/<printername>/<printername>`). The GUI program unpacks the file. See the section “What Happens When a PPD Driver Is Installed” and the `packppdfiles(1)` reference page for more details.

## What Happens When a PPD Driver Is Installed

The first step involved when adding a printer is to invoke the Printer Manager followed by the `Add` function (or run the equivalent shell scripts: mknetpr(1M), mkcentpr(1M), mkscsipr(1M), and so on). One of the first events to occur is the `modelinfo` command is run to update the `/var/spool/lp/modelinfo.dat` file. `modelinfo.dat` contains a list of supported printers and is used to generate the list of printers displayed to a user (the printer manager uses the `modelinfo.dat` file, as do the shell scripts). If either of the directories `/var/spool/lp/model` or `/var/spool/lp/PPD_model` have been updated (files added, deleted or modified) then `modelinfo.dat` will be updated (this may take a few seconds to run); otherwise, `modelinfo.dat` is deemed to be up to date and is not changed.

Once the user has selected the printer to install, the Printer Manager runs the `/usr/lib/lputil` utility script in this manner:

    /usr/lib/lputil add <device> <model file name> <option string>

The arguments are as follows

- <device> is the output device, such as `/dev/plp` for a parallel port.

- <model file name> is the lp model name from `/var/spool/lp/model`.

- <option string> is the list of replaceable options parsed from the printer's entry in the `/var/spool/lp/modelinfo.dat` file.

`/usr/lib/lputil` searches the <model file name> for the substring `impressario_ppd_model`. If the substring is found in the name then `/usr/lib/lputil` will setup the PPD driver for this printer. To do that, `/usr/lib/lputil` performs these steps:

1. Extracts the name of the PPD file (found in the `/var/spool/lp/PPD_model` directory) from the <option string> argument (which will contain a string similar to `ppdname=loptrac.ppd` for PPD-supported printers).

2. Creates a link from `/var/spool/lp/gui_interface/ELF/<printername>` to `/var/spool/lp/gui_model/ELF/impressario_ppd_model.gui`.

3. Converts the `/var/spool/lp/PPD_model/<ppd_filename>` to an Impressario POD file using `ppdtopod` (see the `ppdtopod(1)` reference page for more details). This results in the creation of the following files:

   - `/usr/lib/print/data/impressario_ppd_model.config`

   - `/usr/lib/print/data/impressario_ppd_model.log`

   - `/usr/lib/print/data/impressario_ppd_model.status`

     These files remain on the system and will always contain information specific to the last PPD printer installed.

4. Copies the above three files to `/var/spool/lp/pod/<printername>.[config,log,status]`.

5. Determines if the output device is monochrome, RGB, or CMYK, based on the <option string> argument for `numcolors=`.

6. Creates a link from `/var/spool/lp/PPD_model/<ppd_filename>.extension.ppd` to `/var/spool/lp/PPD_model/impressario_ppd_common*.ppd` (based on the device being monochrome, RGB, or CMYK).

7. Creates the `/var/spool/lp/app-defaults/<printername>/PPD_PostScript` file using the `packppdfiles` utility. See the `packppdfiles(1)` reference page for details.

At this point, `lputil` completes the installation using `lpadmin` to add a printer.

## Where to Find PPD Files for a Specific Printer

PPD files can be found at printer vendor Web sites and FTP sites. Many vendors have a large collection in a single directory that can be downloaded. One notable exception is Hewlett Packard. Their PPDs are not available in a single location; they are incorporated into Hewlett Packard supplied printer drivers. For this reason you may have to contact Hewlett Packard directly to get a PPD file for a particular printer (or download a Windows version of the driver, unzip it, and search the restored files for the PPD file).

A large collection of PPDs for multiple vendors is available from Adobe's FTP site at ftp.adobe.com. Most of these files are already available on the Silicon Graphics system and can be found in the directory `/var/spool/lp/PPD_untested`.

Another collection of PPDs can also be found in `/var/spool/lp/PPD_untested`. These are PPD files that Silicon Graphics has not yet tested. They may or may not work with the Impressario PPD driver. These files are supplied in the `impr_server.sw.ppd_unsupported` subsystem and are provided as a convenience for users who would otherwise have to get them from an FTP site (see the README file in the `/var/spool/lp/PPD_untested` directory for more information). To determine the list of printers supported by the PPD files in the `/var/spool/lp/PPD_untested` directory, enter these commands:

    cd /var/spool/lp/PPD_untested
    grep “*ModelName” * | more

Printers supported by the PPD files in the `/var/spool/lp/PPD_untested` directory are not listed by the Printer Manager. To make the PPD available to the Printer Manager, it has to be copied to the `/var/spool/lp/PPD_model` directory (see the README file in the `/var/spool/lp/PPD_untested` directory for more information).

| Note: Always read the copyright statement in a PPD file before distributing it. Some allow redistribution and others do not.

## Applicable Reference Pages

Table I-1 shows a list of applicable reference pages.

Table I-1. Applicable Reference Pages

Reference Page | Description
--- | ---
`ppdtopod(1)` | Converts a PPD file to an Impressario POD file
`impressario_ppd_model(1)` | Printer configuration dialog
`ppd(1)` | Printer driver overview
`packppdfiles(1)` | Packs all files needed by the Impressario PPD driver into one file
`genppdtemplate(1)` | Extracts PPD strings as X11 resources

Prev | Table of Contents | Next
Appendix H. Using the Adobe Configurable PostScript Interpreter |  | Glossary