Configuring Wine for Printing

The normal way to access the printer with Wine will be using the printer setup of your Linux (BSD/Unix). For the impatient who we will give a short step-by-step introduction. But you should read the HOWTOs mentioned above, if you do not get it working! Those who already have a working printer setup should try step 6 and go straight to the next subsection, if step 6 works.

Short Steps to get a Printer connected and tested with Linux

Step 1:

connect the printer to any parallel port.

Step 2:

test, whether the devices /dev/lpx can be found

Step 3a:

if not: refer to printing-HOWTO and documentation delivered with your Linux distribution first. Then go back to 2.

Step 3b:

if yes, test if the printer will work with
$ echo "test" > /dev/lp0
if your printer is connected to lp0 or
$ echo "test" > /dev/lp1
if the printer is connected to lp1.

Step 4a:

If the printer does not print anything, look whether it is switched on, connected to the computer and the printer is plugged into the wall outlet. If that all is okay and the printer prints nonsense refer to the printer documentation whether it is a windows only printer. You may look up Hardware-HOWTO and Printing HOWTO, too for supported printers.

Step 4b:

If you see the text "test" on the paper, you won. The printer should work with Linux.

Step 5:

Get your printer set up to work with Linux: Install

If you do not understand the configuration of the packages above refer to the Printing-HOWTO and the documentation and man pages. Simple examples to help you understanding are given in this HOWTO you are reading.

Step 6:

If you are ready with step five, test the printer with a simple text file. (if you do not find one, edit one with e.g. vi).
$ lpr testfile.txt
This should work either as user or as root. If printing this file works find any Postscript file on your computer to test the filter. Postscript files have the extension "ps".
$ lpr
( is delivered with Ghostscript.) If this works fine, too, you are able to print even with Wine.

To configure Wine follow the configuration description further down in this HOWTO.

Wine Printing Configuration

CONFIGURATION: Common tasks for both Wine native Postscript driver and for Windows drivers in the wine.conf (~./winerc) file. Several examples are shown below. You will also have to add entries to your win.ini and to the registry. This section only covers the Wine configuration files.

The printers connected to your system should be added to your wine.conf (~/.winerc) in the [spooler] section. If you do not want to use more than one printer and not more than one printer driver, you do not need more than one entry in the [spooler]section of the wine.conf (~./winerc).


This example says your system is set up to print to printer LPT1 by sending the file /tmp/fred created by ghostscript (gs) and using bj200 as the printer driver (-sDEVICE). (-q) tells ghostscript to suppress the normal startup messages and (-) tells ghostscript to expect its input from a file and to process the commandline after the end of file marker is found and exit when done.

You may use more than one printer port (LPT) to reflect different printer drivers with Wine.


This example says your system is set up to connect the same printer used with linux for LPT1 and LPT2. The command used is lpr (off line print). Which command is used for printing depends on your distribution especially your operating system (with Solaris the printing command may be lp instead of lpr). If no printer is given via command line parameter (see "man lpr" or "man lp" for command line options). The default printer information used by lpr is found in /etc/printcap.

This example says Wine uses the default print command as pipe for the data on LPT1. LPT2 is set up to print to a file using ghostscript, LPT3 is set up to use a printer connected to lp3 directly (useful, if using a native printer driver with Wine, but still not working?).

In this example LPT1 and LPT2 are setup to use different printers with Solaris. The first one is the default printer, the second one another printer named duplex_1.

Printing with the Internal Postscript Driver of Wine

CONFIGURATION: Additional entries needed for the builtin Wine PostScript Driver.

Wine has an internal Postscript driver. The name of the Printer is "Wine PostScript Driver", short "WINEPS".

Getting files and set up the configuration

To get the internal Postscript driver working you will have to fetch some additional files and make some changes to your wine.conf (or ~/winerc).

The files needed are some Adobe Font Metric (AFM) files for the fonts you wish to use and a PPD file for your printer.

The PPD file normally is found on the setup CD or the setup disk of your printer. For a HP Laserjet 2100 it is found in the Windows NT directory of the Setup cd. If you own an older printer, you may find a PPD file at Adobe Printer driver Web Page or Adobe FTP PPD-Directory

The Adobe Font Metric files are found at Adobe Font Metric FTP-Directory. We assume you fetched the afm-file from the subdirectory "base35".

As the Postscript driver at present (990911) does not support downloading additional fonts, you will have to fetch only the font metric files for the fonts already present on your printer. Wine still supports only Postscript level one. So be sure to get the correct font metric files.

The PPD file (printername.ppd) can be put to your windows directory (eg /home/wine/windows). To make Wine see it you have to create a [psdrv] section into your wine.conf (~/.winerc) and add the following entry:

Edit the path and the filename above to fit your system! If you do not have this entry in your configuration, the Postscript driver will search for a file named default.ppd in the directory from which Wine is started. But it seems impractical to have this file in each directory you start Wine from. So you really should make the changes to your configuration file.

The AFM files may be copied to another subdirectory, eg /home/wine/afm/filename.afm

This should be added to the wine.conf (~/winerc):

Edit the path and the filename above to fit your system and add a line for each font.

As the font names reflected by the file names are not very readable, you may find it useful to create a subdirectory for each font built from the font names.

You do not need to add "printer=on" to the [wine] section of your ~/.winerc to print with the internal driver.

Changes to win.ini

First you have to add the default printer to the [windows] section and the [devices] section of the win.ini (in ~/.wine or found in your c:\windows directory):

In addition you have to add the printer to the registry used by Wine. To add an entry, you will have to use regapi which is hopefully already present on your system. If you compiled Wine from source, you will have to compile it. To do this change to programs/regapi/regapi in the Wine source tree and type make.

In the source tree documentation/psdrv.reg you will find an example reg-file for the driver. Edit it to suit your requirements (especially the printer port) and call ./regapi setValue <../../documentation/psdrv.reg. The registry entry needed for the Wine Postscript driver looks like this:

Note: The printer port (here: LPT1) has to be reflected in your wine.conf (~/.winerc)! If you made these changes, you should be able to print with the Wine Postscript Printer.

Printing Using a Windows Driver

Printing with a native printer driver

This section is as experimental and buggy as printing with native printer drivers from an application running with Wine. To get my HP Laserjet printing with the PLC Diver, I just copied the files from my Windows Installation to my Wine installation. The win.ini is edited by hand and not during setup of the printer.

The first thing to enable a native printer driver is to make a change to the wine.conf (~/.winerc):

Having done this, you should be able to run the setup program from your installation disk or CD. If you want to install additional True Type Fonts you should refer to the fonts section of the HOWTO to make them accessible using Wine after installation.

After installation you should find some new entries in your ~/.wine/win.ini.

The examples given here are from my own win.ini. You may find some different changes in your win.ini.

Note: This example is not made from normal setup. I just copied the entries from my Windows directory of my Windows for Workgroups installation.