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