Setting Device Modes on New Printers
For a printer to be truly usable by a Windows NT/200x/XP client, it must possess:
generated by the driver for the printer (defining things
like paper size, orientation and duplex settings).
A complete set of
printer driver data
generated by the driver.
If either of these is incomplete, the clients can produce less than optimal output at best. In the
worst cases, unreadable garbage or nothing at all comes from the printer, or it produces a harvest of
error messages when attempting to print. Samba stores the named values and all printing-related information in
its internal TDB database files
The device mode and the set of printer driver data are basically collections
of settings for all print queue properties, initialized in a sensible way. Device modes and
printer driver data should initially be set on the print server (the Samba host) to healthy
values so the clients can start to use them immediately. How do we set these initial healthy values?
This can be achieved by accessing the drivers remotely from an NT (or 200x/XP) client, as discussed
in the following paragraphs.
Be aware that a valid device mode can only be initiated by a
printer admin or root
(the reason should be obvious). Device modes can be correctly set only by executing the printer driver program
itself. Since Samba cannot execute this Win32 platform driver code, it sets this field initially to NULL
(which is not a valid setting for clients to use). Fortunately, most drivers automatically generate the
printer driver data that is needed when they are uploaded to the
the help of the APW or rpcclient.
The generation and setting of a first valid device mode, however, requires some tickling from a client
to set it on the Samba server. The easiest means of doing so is to simply change the page orientation on
the server's printer. This executes enough of the printer driver program on the client for the desired
effect to happen and feeds back the new device mode to our Samba server. You can use the native Windows
NT/200x/XP printer properties page from a Window client for this:
Procedure20.2.Procedure to Initialize the Printer Driver Settings
Browse the Network Neighborhood.
Find the Samba server.
Open the Samba server's Printers and Faxes folder.
Highlight the shared printer in question.
Right-click on the printer (you may already be here if you followed the last section's description).
At the bottom of the context menu select
(if the menu still offers the
entry further above, you
need to click on that one first to achieve the driver
installation, as shown in the last section).
Go to the Advanced tab; click on .
page setting to (and back).
Make sure to apply changes between swapping the page orientation to cause the change to actually take effect.
While you are at it, you may also want to set the desired printing defaults here, which then apply to all future
client driver installations.
This procedure executes the printer driver program on the client platform and feeds back the correct
device mode to Samba, which now stores it in its TDB files. Once the driver is installed on the client,
you can follow the analogous steps by accessing the
folder, too, if you are a Samba printer admin user. From now on, printing should work as expected.
Samba includes a service-level parameter name
for generating a default
device mode for a printer. Some drivers function well with Samba's default set of properties. Others
may crash the client's spooler service. So use this parameter with caution. It is always better to have
the client generate a valid device mode for the printer and store it on the server for you.