Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Samba HowTo Guide
Prev Home Next

Setting Device Modes on New Printers

For a printer to be truly usable by a Windows NT/200x/XP client, it must possess:

  • A valid device mode 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 (ntprinters.tdb, ntdrivers.tdb, printing.tdb, and ntforms.tdb).

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 [print$] share with 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

  1. Browse the Network Neighborhood.

  2. Find the Samba server.

  3. Open the Samba server's Printers and Faxes folder.

  4. Highlight the shared printer in question.

  5. Right-click on the printer (you may already be here if you followed the last section's description).

  6. At the bottom of the context menu select Properties (if the menu still offers the Connect entry further above, you need to click on that one first to achieve the driver installation, as shown in the last section).

  7. Go to the Advanced tab; click on Printing Defaults.

  8. Change the Portrait page setting to Landscape (and back).

  9. Make sure to apply changes between swapping the page orientation to cause the change to actually take effect.

  10. 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 local Printers 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 default devmode 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.

Samba HowTo Guide
Prev Home Next

  Published under the terms fo the GNU General Public License Design by Interspire