This chapter discusses the Impressario printing and scanning architectures and defines Impressario compliance for printer driver and scanner driver developers. By complying with Impressario guidelines, you make your job easier, you ensure a consistent end-user experience, and you greatly improve the chances of effortless transitions to future releases of Impressario.
The following topics are discussed in this chapter:
Impressario allows files of different types to be printed on any installed printer and images to be scanned from a scanner, a workstation monitor, or a Silicon Graphics Image file. A visual end-user environment makes it easy for users to add new devices and for applications to take advantage of those devices by providing graphical interfaces for these purposes:
using scanners (see gscan(1))
To maintain a consistent, reliable, and easy-to-use environment, Impressario provides the following libraries for application developers:
a C application program interface (API) to the UNIX printer spooling system
a C graphical user interface (GUI) library for printing that is compatible with Motif
a C-language API to the Impressario scanning system
a C-language API for reading and writing Stream TIFF (STIFF) files
a C-language API for reading and writing Silicon Graphics Image files
The following final, crucial elements must be provided by driver developers:
This section describes the steps that developers of printer drivers and printing applications must take to comply with Impressario specifications.
Figure 1-1 is an overview of Impressario printing components. A more detailed version of this diagram is available online in /usr/impressario/doc.
The following sections detail the steps that should be followed to achieve Impressario compliance for printer drivers and printing applications.
The steps shown in Figure 1-2 (discussed below) show how to develop and integrate a printer driver for Impressario.
Your printer driver must comply with the Impressario Filter/Driver Specification (see “The Filter/Driver Specification and psrip” in Chapter 2) so that a model file that is Impressario-compliant can execute the driver correctly. This specification describes standard driver behavior and the command-line arguments that must be processed. See /usr/impressario/src/drivers and Chapter 2 for the source code and an example driver. The driver must update the POD files through calls to “local” functions of the library libpod. (See Chapter 5, “Printing Libraries.”) The formats of the POD files are described in Appendix C, “Printer Object Database (POD) File Formats.”
A set of POD files consists of a configuration file, a printer log file, and a printer status file. Each POD file has the same base name as the printer model file. The extensions on these files are: .config, .log, and .status, respectively. To create these files, start with the example set of POD files in the directory /usr/impressario/src/data. The POD files you create must be installed in the directory /usr/lib/print/data when you install your software. See Chapter 10, “Packaging Your Impressario Product,” for more information.
Your model file must conform to the Impressario model file specification. This is done by starting with the template model file provided with Impressario and adding your developer-specific processing. Model files must be installed in /var/spool/lp/model. Follow the Impressario model file template to create a model file that properly updates the desktop printer status icon and interacts properly with Impressario subsystems. (See Chapter 3, “Printer Model Files,” for more information on model files.)
Filters must conform to the filter/driver specification. (See “The Filter/Driver Specification and psrip” in Chapter 2 for more information.) Filter programs must be installed in /usr/lib/print. It is recommended that any data filtering be performed directly by the driver. (Filters are programs that change the format of a data file; drivers communicate bidirectionally with the printer.) See Chapter 11 for step-by-step instructions on adding new file conversion filters.
This step is optional, but it is strongly recommended that you showcase the features of your printer by providing a graphical options panel program. (See Chapter 4, “Printer Graphical Options Panel,” for details.)
Package your Impressario software product for distribution. See Chapter 10 for detailed information.
Check that your product media will install the printer support files you have developed on an Impressario server. Run the Impressario test programs testipr and testiconfig to assist in verifying the installation. (See Chapter 9 for detailed information.)
To print a document on UNIX systems, you must submit a print job to one of the available spooling systems: the BSD spooling system (lpr command) or the System V spooling system (lp command). The System V spooling system is the default spooling system on all Silicon Graphics workstations. Figure 1-3 shows the general Impressario spooling architecture for the lp spooler. Note that only one of the two paths shown below (PostScript printer or raster printer) would apply. That is, the output is either to a PostScript printer or a raster printer, not both.
Before Impressario, a true application program interface to the BSD™ and System V spooling systems was not available. Programmers had to create their own application programming interface or execute the lp or lpr command from their application.
Impressario provides the application program interfaces listed in Table 1-1 below.
System V, BSD
Allows submission of a file or buffer to a printer
System V only
Provides Motif PrintBox widget for printing from application
System V, BSD
Gets status information on the printers currently available
The API libprintui is built on top of libspool. The libprintui library contains a widget, compatible with Motif, that you can incorporate directly into your application. If your Motif application needs printing capabilities, libprintui will provide you with all of the basic functionality for submitting a print job as well as access to setting and saving printer-specific options. As mentioned earlier, libprintui interfaces only with the System V spooling system.
The libpod library is built on top of libspool and an ancillary system daemon, podd. The libpod library allows you to obtain detailed information about the capabilities of the printers currently available on the system. You can also get detailed status information about the printers. Most applications do not need to use libpod; however, for those that do, libpod provides a very powerful, network-transparent interface.
Figure 1-4 shows the relationship between an application program, the Impressario APIs, and the System V spooling system.
Figure 1-5 shows the relationship between an application program, the Impressario libspool API, and the BSD spooling system.
The “print” subsystem available with the IRIX operating system contains the program glp, a graphical standalone print job submittal tool. While not a true API, glp can be used by your application to submit print jobs. It is a standalone wrapper around the PrintBox Motif widget in libprintui.
The following Impressario application printing solutions are available:
Use libspool, the spooling system abstraction library, for all non-graphical interaction with the BSD or System V spooling system. The libspool library functions perform a large amount of work to ensure successful spooling system interaction, work that a developer may not wish to reproduce.
Use the PrintBox Motif widget provided by the libprintui library for graphical print job submittal. The widget provides a consistent job submission dialog across all applications and greatly reduces the amount of development effort required. If you use this library, you don't need to use libspool directly. libprintui encapsulates those calls.
Use libpod library calls to get printer status, configuration, and log information. Status queries must be made through libpod calls; attempts to obtain this information through other means have unpredictable results. In most cases, application developers should use the “standard” forms of the libpod functions (the “local” forms of the functions are for use by printer driver developers and are not network-transparent).
If you are not using Motif, you may use glp to submit graphical print jobs from your application. If you use this method, you should have the print software package (shipped with IRIX 5.2 and later) as a prerequisite. While this method works, it is not recommended, as it is likely to be less efficient than using libprintui.
This section describes how to comply with the Impressario specifications for scanner driver developers and scanner application developers.
Figure 1-6 illustrates the run-time components of the Impressario scanner architecture. Note that scanner applications, scanner-specific options programs, and scanner drivers all link with libscan.a, which has separate modules for scanner applications and for scanner drivers.
Figure 1-7 shows the interprocess communication of the Impressario scanner architecture.
The following sections describe how to achieve Impressario compliance for scanner drivers and applications.
Follow these steps to develop and integrate a scanner driver that complies with Impressario:
Create a graphical options panel. This step is optional, but it is recommended that you showcase the features of your scanner through this mechanism. See Chapter 7, “Scanner-Specific Options,” for detailed instructions.
Create distribution media that will install the driver on an Impressario server. Be sure to check that the media will install the scanner support files you have developed on an Impressario server. See Chapter 10 for detailed information.
There are two ways for an application to interact with the scanning system:
Through libscan. This scanning system abstraction library provides a C-language API for scanners. Application programs can use libscan to retrieve data from any scanning device for which a driver exists. See the libscan(3) reference page for a detailed list of the libscan library functions.
As a plug-in module using gscan, which provides a complete graphical scanning interface. When passed the -p option, gscan writes scanned data to its standard output as a Stream TIFF file. After launching gscan with the -p option, applications can use the STIFF routines in libstiff to acquire the scanned data from the standard output of gscan.