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.
connect the printer to any parallel port.
test, whether the devices /dev/lpx can be found
if not: refer to printing-HOWTO and documentation delivered with your Linux distribution first. Then go back to 2.
if yes, test if the printer will work with
$ echo "test" > /dev/lp0
$ echo "test" > /dev/lp1
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.
If you see the text "test" on the paper, you won. The printer should work with Linux.
Get your printer set up to work with Linux: Install
lpr or LPRng (the printing program),
magicfilter (Filter for printing output), and
gs or gs-aladdin (Ghostscript for translating/creating Postscript files).
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.
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
$ lpr tiger.ps
To configure Wine follow the configuration description further down in this HOWTO.
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).
Example 9-1. Printing to File
[spooler] LPT1:=|gs -sDEVICE=bj200 -sOutputFile=/tmp/fred -q -
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.
Example 9-2. Printing using System Printer
[spooler] LPT1:=|lpr LPT2:=|lpr
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.
Example 9-3. Printing to different Printers
[spooler] LPT1:=|lpr LPT2:=|gs -sDEVICE=bj200 -sOutputFile=/tmp/fred -q - LPT3:=/dev/lp3
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?).
Example 9-4. Different Setting for Same Printer
[spooler] LPT1:=|lp LPT2:=|lp -d duplex_1
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.
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:
Example 9-5. PSDRV Entry in Wine Configuration
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):
Example 9-6. AFM Files Entry in Wine Configuration File
[afmfiles] file1=/home/wine/afm/filename.afm file2=/home/wine/afm/filename2.afm file3=/home/wine/afm/filename3.afm ; ...
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):
Example 9-7. Printer Entry in Win.ini
[windows] device=Wine PostScript Driver,WINEPS,LPT1: [devices] Wine PostScript Driver=WINEPS,LPT1:
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:
Example 9-8. Registry Entry for Wine Postscript Driver
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers\WinePostScript Driver] "Attributes"="dword:00000000" "Default Devmode"= "Name"="Wine PostScript Driver" "Port"="LPT1:" "Print Processor"="WinPrint" "Printer Driver"="PS Driver" "Priority"="dword:00000000" "Start Time"="dword:00000000" "Status"="dword:00000000" "Until Time"="dword:00000000" [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Environments\Windows4.0\Drivers\PS Driver] "Configuration File"="WINEPS.DRV" "Data File"="" "Driver"="WINEPS.DRV" "Version"="dword:0a000000" "Datatype"="" "Dependent Files"="" "Help Files"="" "Monitor"=""
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.
[still no more info available]
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):
Example 9-9. Enable native Printer in Wine Configuration File
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.
Example 9-10. Native Printer in Win.ini for HP 2100
[windows] device=HP LaserJet 2100 Series PCL 6,hpbxlb,LPT2: [devices] Wine PostScript Driver=WINEPS,LPT1: HP LaserJet 2100 Series PCL 6=hpbxlb,LPT2: [FontSubstitutes] Helv=MS Sans Serif Tms Rmn=MS Serif Times=Times New Roman Helvetica=Arial Albertus (W1)=Albertus Medium Albertus Xb (W1)=Albertus Extra Bold Antique Olv (W1)=Antique Olive CG Times (W1)=CG Times Courier (W1)=Courier New Coronet (W1)=Coronet Letter Gothic (W1)=Letter Gothic Univers (W1)=Univers Univers Cd (W1)=Univers Condensed Albertus (WN)=Albertus Medium Albertus Xb (WN)=Albertus Extra Bold Antique Olv (WN)=Antique Olive CG Times (WN)=CG Times Courier (WN)=Courier New Coronet (WN)=Coronet Letter Gothic (WN)=Letter Gothic Univers (WN)=Univers [TrueType] TTEnable=0 TTOnly=0 [HPLJ2100] Language=German Uninstall=H:\WINDOWS\hplj21un.txt [HP LaserJet 2100 Series PCL 6,LPT2] paper=9 prtcaps=-14065 prtcaps2=-26125 prtcaps3=0 qset=(Unbenannt) pqsetting=754 access=512 [HPBXLB,LPT2] FontSummary=H:\WINDOWS\FSBBLPT2.PXL [PostScript,LPT2] ATM=placeholder [HP LaserJet 2100 Series PCL 6,] paper=9 prtcaps=-14065 prtcaps2=-26125 prtcaps3=0 [HPBXLB,] FontSummary=H:\WINDOWS\FSBBNONE.PXL [PrinterPorts] HP LaserJet 2100 Series PCL 6=hpbxlb,LPT2:,15,45
Note: This example is not made from normal setup. I just copied the entries from my Windows directory of my Windows for Workgroups installation.