[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Guide to Printers and Printing

Printer Backend Overview for Programming

The base operating system printer backend receives and processes print requests from a spooler, usually the qdaemon command. The printer backend is a standard feature of the base operating system. It is implemented by the piobe command

The printer backend supports all of the printers installed in the Object Data Manager (ODM) Predefined database. You can customize the printer backend to assist in the administration of the printing subsystem. For more information, see Printers, Print Jobs, and Queues for System Administrators. You can also modify the printer backend to add unsupported printers and National Language Support (NLS) code page translation tables.

Adding a printer to the printer backend involves adding a printer colon file for that printer. In many cases, the printer colon file of a similar printer can be duplicated with little modification. If modification of an existing printer colon file is not sufficient, you can write a print formatter. If the modifications exceed the scope of the print formatter, you may need to write a new printer backend.

Refer to the following sections for more information:

The procedure for translating NLS code points in the print file to code points for the printers varies depending upon whether the code sets are single-byte or multibyte. For more information, see:

Third-party vendors may want to customize the printer backend for special purposes.

Printer Backend Data Flow

The primary purpose of a backend is to send characters to a device, usually a printer. The printer backend is invoked once for every file or group of files to be printed, with the name of each file passed to the backend as a parameter. The backend opens the file, reads it, and sends it to the device. The recommended method for a backend to operate is to write to its standard output, with the qdaemon process opening the device onto the correct file descriptor. This requires setting the file field in the qconfig file.

The name of the file to be printed can be a direct or relative path name. The user ID and group ID of the backend are those of the process that invoked the enq command.

When a backend is invoked, it has access to the user's environment. To access the user's environment, the backend may invoke the getenv subroutine. For example, to access the user's directory, getenv(PWD) returns a pointer to the directory name. The backend can use this to read from or write to this directory.

If the backend writes to its standard output, the qdaemon opens the device in root-user mode. If the backend needs to open the device itself, it must have the correct permissions to open the device. Since the backend runs under the permissions of the user sending the print job, you may need to change the protections on the device or install the backend set-user-ID or set-group-ID.

By default, stdin, stdout, and stderr are all open to the null device (/dev/null), although it is possible to override the setting of stdout (and possibly stdin) with the file and access fields in the qconfig file.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]