Printing in Wine How to print documents in Wine... Printing Written by &name-huw-davies; &email-huw-davies; (Extracted from wine/documentation/printing) Printing in Wine can be done in one of two ways: Use the builtin Wine PostScript driver (+ ghostscript to produce output for non-PostScript printers). Use an external windows 3.1 printer driver (outdated, probably won't get supported any more). Note that at the moment WinPrinters (cheap, dumb printers that require the host computer to explicitly control the head) will not work with their Windows printer drivers. It is unclear whether they ever will. Builtin Wine PostScript driver Enables printing of PostScript files via a driver built into Wine. See below for installation instructions. The code for the PostScript driver is in dlls/wineps/. The driver behaves as if it were a DRV file called wineps.drv which at the moment is built into Wine. Although it mimics a 16 bit driver, it will work with both 16 and 32 bit apps, just as win9x drivers do. External printer drivers (non-working as of Jul 8, 01) At present only 16 bit drivers will work (note that these include win9x drivers). To use them, add printer=on to the [wine] section of wine.conf (or ~/.wine/config). This lets CreateDC proceed if its driver argument is a 16 bit driver. You will probably also need to add "TTEnable" = "0" "TTOnly" = "0" to the [TrueType] section of ~/.wine/config. The code for the driver interface is in graphics/win16drv. Spooling Spooling is rather primitive. The [spooler] section of wine.conf maps a port (e.g. LPT1:) to a file or a command via a pipe. For example the following lines "LPT1:" = "foo.ps" "LPT2:" = "|lpr" map LPT1: to file foo.ps and LPT2: to the lpr command. If a job is sent to an unlisted port, then a file is created with that port's name; e.g. for LPT3: a file called LPT3: would be created. There are now also virtual spool queues called LPR:printername, which send the data to lpr -Pprintername. You do not need to specify those in the config file, they are handled automatically by dlls/gdi/printdrv.c. The Wine PostScript Driver Written by &name-huw-davies; &email-huw-davies; (Extracted from wine/documentation/psdriver) This allows Wine to generate PostScript files without needing an external printer driver. Wine in this case uses the system provided PostScript printer filters, which almost all use ghostscript if necessary. Those should be configured during the original system installation or by your system administrator. Installation Installation of CUPS printers If you are using CUPS, you do not need to configure .ini or registry entries, everything is autodetected. Installation of LPR /etc/printcap based printers If your system is not yet using CUPS, it probably uses LPRng or a LPR based system with configuration based on /etc/printcap. If it does, your printers in /etc/printcap are scanned with a heuristic whether they are PostScript capable printers and also configured mostly automatic. Since WINE cannot find out what type of printer this is, you need to specify a PPD file in the [ppd] section of ~/.wine/config. Either use the shortcut name and make the entry look like: [ppd] "ps1" = "/usr/lib/wine/ps1.ppd" Or you can specify a generic PPD file that is to match for all of the remaining printers. A generic PPD file can be found in documentation/samples/generic.ppd. Installation of other printers You do not need to do this if the above 2 sections apply, only if you have a special printer. Wine PostScript Driver=WINEPS,LPT1: to the [devices] section and Wine PostScript Driver=WINEPS,LPT1:,15,45 to the [PrinterPorts] section of win.ini, and to set it as the default printer also add "device" = "Wine PostScript Driver,WINEPS,LPT1:" to the [windows] section of ~/.wine/config and ??? [sic] You also need to add certain entries to the registry. The easiest way to do this is to customise the contents of documentation/psdrv.reg (see below) and use the Winelib program programs/regapi/regapi. For example, if you have installed the Wine source tree in /usr/src/wine, you could use the following series of commands: cp /usr/src/wine/documentation/psdrv.reg ~ vi ~/psdrv.reg Edit the copy of psdrv.reg to suit your requirements. At a minimum, you must specify a PPD file for each printer. regapi setValue < ~/psdrv.reg Required configuration for all printer types You won't need Adobe Font Metric (AFM) files for the (type 1 PostScript) fonts that you wish to use any more. Wine now has this information builtin. You'll need a PPD file for your printer. This describes certain characteristics of the printer such as which fonts are installed, how to select manual feed etc. Adobe has many of these on its website, have a look in ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/. See above for information on configuring the driver to use this file. To enable colour printing you need to have the *ColorDevice entry in the PPD set to true, otherwise the driver will generate greyscale. Note that you need not set printer=on in the [wine] section of wine.conf, this enables printing via external printer drivers and does not affect the builtin PostScript driver. If you're lucky you should now be able to produce PS files from Wine! I've tested it with win3.1 notepad/write, Winword6 and Origin4.0 and 32 bit apps such as win98 wordpad, Winword97, Powerpoint2000 with some degree of success - you should be able to get something out, it may not be in the right place. TODO / Bugs Driver does read PPD files, but ignores all constraints and doesn't let you specify whether you have optional extras such as envelope feeders. You will therefore find a larger than normal selection of input bins in the print setup dialog box. I've only really tested ppd parsing on the hp4m6_v1.ppd file. No TrueType download. StretchDIBits uses level 2 PostScript. AdvancedSetup dialog box. Many partially implemented functions. ps.c is becoming messy. Notepad often starts text too far to the left depending on the margin settings. However the win3.1 pscript.drv (under wine) also does this. Probably many more... Please contact me if you want to help so that we can avoid duplication. &name-huw-davies; &email-huw-davies;