Set low-order bit of module handle for LOAD_LIBRARY_AS_DATAFILE.
[wine] / documentation / printing.sgml
1   <sect1 id="printing">
2     <title>Printing in Wine</title>
3     <para>How to print documents in Wine...</para>
4
5     <sect2 id="wine-printing">
6       <title>Printing</title>
7
8       <para>
9         Written by &name-huw-davies; <email>&email-huw-davies;</email>
10       </para>
11       <para>
12         (Extracted from <filename>wine/documentation/printing</filename>)
13       </para>
14
15       <para>
16         Printing in Wine can be done in one of two ways:
17       </para>
18       <orderedlist>
19         <listitem>
20           <para>Use an external windows 3.1 printer driver.</para>
21         </listitem>
22         <listitem>
23           <para>
24             Use the builtin Wine Postscript driver (+ ghostscript to produce
25             output for non-postscript printers).
26           </para>
27         </listitem>
28       </orderedlist>
29
30       <para>
31         Note that at the moment WinPrinters (cheap, dumb printers that require
32         the host computer to explicitly control the head) will not work with
33         their Windows printer drivers.  It is unclear whether they ever will.
34       </para>
35
36       <sect3>
37         <title>External printer drivers</title>
38         <para>
39           At present only 16 bit drivers will work (note that these include
40           win9x drivers).  To use them, add
41         </para>
42         <screen>
43 printer=on
44         </screen>
45         <para>
46           to the [wine] section of <filename>wine.conf</filename> (or
47           <filename>~/.wine/config</filename>). This lets
48           <function>CreateDC</function> proceed if its driver argument is a 16
49           bit driver. You will probably also need to add
50         </para>
51         <screen>
52 "TTEnable" = "0" "TTOnly" = "0"
53         </screen>
54         <para>
55           to the [TrueType] section of <filename>~/.wine/config</filename>. The code for
56           the driver interface is in <filename>graphics/win16drv</filename>.
57         </para>
58       </sect3>
59
60       <sect3>
61         <title>Builtin Wine PostScript driver</title>
62         <para>
63           Enables printing of PostScript files via a driver built into Wine. See
64           below for installation instructions. The code for the PostScript
65           driver is in <filename>dlls/wineps/</filename>.
66         </para>
67         <para>
68           The driver behaves as if it were a DRV file called
69           <filename>wineps.drv</filename> which at the moment is built into
70           Wine.
71           Although it mimics a 16 bit driver it will work with both 16 and 32
72           bit apps, just as win9x drivers do.
73         </para>
74       </sect3>
75
76       <sect3>
77         <title>Spooling</title>
78         <para>
79           Spooling is rather primitive. The [spooler] section of
80           <filename>wine.conf</filename> maps a port (e.g.
81           <systemitem>LPT1:</systemitem>) to a file or a command via a pipe. For
82           example the following lines
83         </para>
84         <screen>
85 "LPT1:" = "foo.ps" "LPT2:" = "|lpr"
86         </screen>
87         <para>
88           map <systemitem>LPT1:</systemitem> to file <filename>foo.ps</filename>
89           and <systemitem>LPT2:</systemitem> to the <command>lpr</command>
90           command. If a job is sent to an unlisted port then a file is created
91           with that port's name e.g. for <systemitem>LPT3:</systemitem> a file
92           called <systemitem>LPT3:</systemitem> would be created.
93         </para>
94         <para>
95           There are now also virtual spool queues called
96           <systemitem>LPR:printername</systemitem>, which send the data
97           to <command>lpr -Pprintername</command>. You do not need to 
98           specify those in the config file, they are handled automatically by
99           <filename>dlls/gdi/printdrv.c</filename>.
100         </para>
101       </sect3>
102     </sect2>
103
104     <sect2 id="psdriver">
105       <title>The Wine PostScript Driver</title>
106
107       <para>
108         Written by &name-huw-davies; <email>&email-huw-davies;</email>
109       </para>
110       <para>
111         (Extracted from <filename>wine/documentation/psdriver</filename>)
112       </para>
113
114       <para>
115         This allows Wine to generate PostScript files without
116         needing an external printer driver. Wine in this case uses the
117         system provided postscript printer filters, which almost all use
118         ghostscript if necessary. Those should be configured during the
119         original system installation or by your system administrator.
120       </para>
121
122       <sect3>
123         <title>Installation</title>
124         <sect4>
125           <title>Installation of CUPS printers</title>
126           <para>
127             If you are using CUPS you do not need to configure .ini or
128             registry entries, everything is autodetected.
129           </para>
130         </sect4>
131         <sect4>
132           <title>Installation of LPR /etc/printcap based printers</title>
133           <para>
134             If your system is not yet using CUPS, it probably uses LPRng
135             or a LPR based system with configuration based on /etc/printcap.
136           </para>
137           <para>
138             If it does, your printers in <filename>/etc/printcap</filename>
139             are scanned with a heuristic whether they are PostScript capable
140             printers and also configured mostly automatic.
141           </para>
142           <para>
143             Since WINE cannot find out what type of printer this is, you 
144             need to specify a PPD file in the [ppd] section of
145             <filename>~/.wine/config</filename>. Either use the shortcut
146             name and make the entry look:
147           </para>
148           <screen>
149             [ppd]
150             "ps1" = "/usr/lib/wine/ps1.ppd"
151           </screen>
152           <para>
153             Or you can specify a generic PPD file matching for all of the rest
154             printers. A generic PPD file can be found in
155             <filename>documenation/samples/generic.ppd</filename>.
156           </para>
157         </sect4>
158         <sect4>
159           <title>Installation of other printers</title>
160           <para>
161             You do not need to this, if the above 2 sections apply, only if
162             you have a special printer.
163           </para>
164           <screen>
165   "Wine PostScript Driver" = "WINEPS,LPT1:"
166           </screen>
167           <para>
168             to the [devices] section and
169           </para>
170           <screen>
171   "Wine PostScript Driver" = "WINEPS,LPT1:,15,45"
172           </screen>
173           <para>
174             to the [PrinterPorts] section of <filename>win.ini</filename> and to set it
175             as the default printer also add
176           </para>
177           <screen>
178   "device" = "Wine PostScript Driver,WINEPS,LPT1:"
179           </screen>
180           <para>
181             to the [windows] section of <filename>~/.wine/config</filename> and ???
182             <emphasis>[sic]</emphasis>
183           </para>
184           <para>
185             You also need to add certain entries to the registry.  The easiest way
186             to do this is to customise the contents of
187             <filename>documentation/psdrv.reg</filename> (see below) and use the
188             Winelib program <command>programs/regapi/regapi</command>.  For
189             example, if you have installed the Wine source tree in
190             <filename>/usr/src/wine</filename>, you could use the following
191             series of commands:
192             <itemizedlist>
193               <listitem>
194                 <para>
195                   <userinput>cp /usr/src/wine/documentation/psdrv.reg ~</userinput>
196                 </para>
197               </listitem>
198               <listitem>
199                 <para><userinput>vi ~/psdrv.reg</userinput></para>
200               </listitem>
201               <listitem>
202                 <para>
203                   Edit the copy of <filename>psdrv.reg</filename> to suit your
204                   requirements.  At a minimum, you must specify a PPD file for
205                   each printer.
206                 </para>
207               </listitem>
208               <listitem>
209                 <para>
210                   <userinput>regapi setValue &lt; ~/psdrv.reg</userinput>
211                 </para>
212               </listitem>
213             </itemizedlist>
214           </para>
215         </sect4>
216         <sect4>
217           <title>Required Configuration for all printertypes</title>
218           <para>
219             You will need Adobe Font Metric (AFM) files for the (type 1 PostScript)
220             fonts that you wish to use. You can get these from
221             <ulink url="ftp://ftp.adobe.com/pub/adobe/type/win/all/afmfiles">
222               ftp://ftp.adobe.com/pub/adobe/type/win/all/afmfiles </ulink>. The
223             directories <filename>base17</filename> or <filename>base35</filename>
224             are good places to start. Note that these are only the font metrics and
225             not the fonts themselves. At the moment the driver does not download
226             additional fonts, so you can only use fonts that are already present on
227             the printer.  (Actually, the driver can use any font that is listed in
228             the PPD file, for which it has an AFM file.  If you use fonts that are
229             <emphasis>not</emphasis> installed in your printer, or in
230             Ghostscript, you will need to use some means of embedding the font in
231             the print job or downloading the font to the printer.  Note also that
232             the driver does not yet properly list required fonts in its DSC
233             comments, so a print manager that depends on these comments to
234             download the proper fonts to the printer may not work properly.)
235           </para>
236           <para>
237             Then create a [afmdirs] section in your
238             <filename>wine.conf</filename> (or
239             <filename>~/.wine/config</filename>) and add a line of the form
240           </para>
241           <screen>
242   "dir&lt;n&gt;" = "/unix/path/name/"
243           </screen>
244           <para>
245             for each directory that contains AFM files you wish to use.
246           </para>
247           <para>
248             There usually are a lot of afm files already on your system,
249             within ghostscript, enscript, a2ps or similar programs. You might
250             check (and probably add) the following entries to the [afmdirs]
251             section.
252           </para>
253           <screen>
254             "1" = "/usr/share/ghostscript/fonts"
255             "2" = "/usr/share/a2ps/afm"
256             "3" = "/usr/share/enscript"
257             "4" = "/usr/X11R6/lib/X11/fonts/Type1"
258           </screen>
259           <para>
260             You also require a PPD file for your printer.  This describes
261             certain characteristics of the printer such as which fonts are
262             installed, how to select manual feed etc. Adobe also has many of
263             these on its website, have a look in
264             <ulink url="ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/">
265             ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/</ulink>.
266             See above for information on configuring the driver to use this
267             file.
268           </para>
269           <para>
270             To enable colour printing you need to have the
271             <literal>*ColorDevice</literal> entry in the PPD set to
272             <literal>true</literal>, otherwise the driver will generate
273             greyscale.
274           </para>
275           <para>
276             Note that you need not set <literal>printer=on</literal> in
277             the [wine] section of <filename>wine.conf</filename>, this
278             enables printing via external printer drivers and does not
279             affect the builtin PostScript driver.
280           </para>
281           <para>
282             If you're lucky you should now be able to produce PS files
283             from Wine!
284           </para>
285           <para>
286             I've tested it with win3.1 notepad/write, Winword6 and
287             Origin4.0 and 32 bit apps such as win98 wordpad, Winword97,
288             Powerpoint2000 with some degree of success - you should be
289             able to get something out, it may not be in the right place.
290           </para>
291         </sect4>
292       </sect3>
293
294       <sect3>
295         <title>TODO / Bugs</title>
296
297         <itemizedlist>
298           <listitem>
299             <para>
300               Driver does read PPD files, but ignores all constraints
301               and doesn't let you specify whether you have optional
302               extras such as envelope feeders. You will therefore find
303               a larger than normal selection of input bins in the
304               print setup dialog box. I've only really tested ppd
305               parsing on the <filename>hp4m6_v1.ppd</filename> file.
306             </para>
307           </listitem>
308           <listitem>
309             <para>No TrueType download.</para>
310           </listitem>
311           <listitem>
312             <para>StretchDIBits uses level 2 PostScript.</para>
313           </listitem>
314           <listitem>
315             <para>AdvancedSetup dialog box.</para>
316           </listitem>
317           <listitem>
318             <para>Many partially implemented functions.</para>
319           </listitem>
320           <listitem>
321             <para>ps.c is becoming messy.</para>
322           </listitem>
323           <listitem>
324             <para>
325               Notepad often starts text too far to the left depending
326               on the margin settings. However the win3.1
327               <filename>pscript.drv</filename> (under wine) also does
328               this.
329             </para>
330           </listitem>
331           <listitem>
332             <para>Probably many more...</para>
333           </listitem>
334         </itemizedlist>
335
336         <para>
337           Please contact me if you want to help so that we can avoid duplication.
338         </para>
339         <para>
340           &name-huw-davies; <email>&email-huw-davies;</email>
341         </para>
342       </sect3>
343     </sect2>
344   </sect1>
345
346 <!-- Keep this comment at the end of the file
347 Local variables:
348 mode: sgml
349 sgml-parent-document:("wine-doc.sgml" "set" "book" "chapter" "")
350 End:
351 -->