Fixed 0 count handling in PSDRV_Text.
[wine/gsoc_dplay.git] / documentation / printing.sgml
blobbbb39dda521db81c8f9023c2c0ce6b8834d0c145
1 <sect1 id="printing">
2 <title>Printing in Wine</title>
3 <para>How to print documents in Wine...</para>
5 <sect2 id="wine-printing">
6 <title>Printing</title>
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>
15 <para>
16 Printing in Wine can be done in one of two ways. Both of which are pretty alpha.
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>
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>
36 <sect3>
37 <title>External printer drivers</title>
38 <para>
39 At present only 16 bit drivers will work (note that these include win9x
40 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>
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>graphics/psdrv</filename>.
66 </para>
67 </sect3>
69 <sect3>
70 <title>Spooling</title>
71 <para>
72 Spooling is rather primitive. The [spooler] section of
73 <filename>wine.conf</filename> maps a port (e.g.
74 <systemitem>LPT1:</systemitem>) to a file or a command via a pipe. For
75 example the following lines
76 </para>
77 <screen>
78 "LPT1:" = "foo.ps" "LPT2:" = "|lpr"
79 </screen>
80 <para>
81 map <systemitem>LPT1:</systemitem> to file <filename>foo.ps</filename>
82 and <systemitem>LPT2:</systemitem> to the <command>lpr</command>
83 command. If a job is sent to an unlisted port then a file is created
84 with that port's name e.g. for <systemitem>LPT3:</systemitem> a file
85 called <systemitem>LPT3:</systemitem> would be created.
86 </para>
87 </sect3>
88 </sect2>
90 <sect2 id="psdriver">
91 <title>The Wine PostScript Driver</title>
93 <para>
94 Written by &name-huw-davies; <email>&email-huw-davies;</email>
95 </para>
96 <para>
97 (Extracted from <filename>wine/documentation/psdriver</filename>)
98 </para>
100 <para>
101 When complete this will allow Wine to generate PostScript files without
102 needing an external printer driver. It should be possible to print to a
103 non PostScript printer by filtering the output through ghostscript.
104 </para>
106 <sect3>
107 <title>Installation</title>
108 <para>
109 The driver behaves as if it were a DRV file called
110 <filename>wineps.drv</filename> which at the moment is built into Wine.
111 Although it mimics a 16 bit driver it will work with both 16 and 32 bit
112 apps, just as win9x drivers do.
113 </para>
114 <para>
115 To install it add
116 </para>
117 <screen>
118 "Wine PostScript Driver" = "WINEPS,LPT1:"
119 </screen>
120 <para>
121 to the [devices] section and
122 </para>
123 <screen>
124 "Wine PostScript Driver" = "WINEPS,LPT1:,15,45"
125 </screen>
126 <para>
127 to the [PrinterPorts] section of <filename>win.ini</filename> and to set it
128 as the default printer also add
129 </para>
130 <screen>
131 "device" = "Wine PostScript Driver,WINEPS,LPT1:"
132 </screen>
133 <para>
134 to the [windows] section of <filename>~/.wine/config</filename> and ???
135 <emphasis>[sic]</emphasis>
136 </para>
137 <para>
138 You also need to add certain entries to the registry. The easiest way
139 to do this is to customise the contents of
140 <filename>documentation/psdrv.reg</filename> (see below) and use the
141 Winelib program <command>programs/regapi/regapi</command>. For
142 example, if you have installed the Wine source tree in
143 <filename>/usr/src/wine</filename>, you could use the following
144 series of commands:
145 <itemizedlist>
146 <listitem>
147 <para>
148 <userinput>cp /usr/src/wine/documentation/psdrv.reg ~</userinput>
149 </para>
150 </listitem>
151 <listitem>
152 <para><userinput>vi ~/psdrv.reg</userinput></para>
153 </listitem>
154 <listitem>
155 <para>
156 Edit the copy of <filename>psdrv.reg</filename> to suit your
157 requirements. At a minimum, you must specify a PPD file for
158 each printer.
159 </para>
160 </listitem>
161 <listitem>
162 <para>
163 <userinput>regapi setValue &lt; ~/psdrv.reg</userinput>
164 </para>
165 </listitem>
166 </itemizedlist>
167 </para>
168 <para>
169 You will need Adobe Font Metric (AFM) files for the (type 1 PostScript)
170 fonts that you wish to use. You can get these from
171 <ulink url="ftp://ftp.adobe.com/pub/adobe/type/win/all/afmfiles">
172 ftp://ftp.adobe.com/pub/adobe/type/win/all/afmfiles </ulink>. The
173 directories <filename>base17</filename> or <filename>base35</filename>
174 are good places to start. Note that these are only the font metrics and
175 not the fonts themselves. At the moment the driver does not download
176 additional fonts, so you can only use fonts that are already present on
177 the printer. (Actually, the driver can use any font that is listed in
178 the PPD file, for which it has an AFM file. If you use fonts that are
179 <emphasis>not</emphasis> installed in your printer, or in
180 Ghostscript, you will need to use some means of embedding the font in
181 the print job or downloading the font to the printer. Note also that
182 the driver does not yet properly list required fonts in its DSC
183 comments, so a print manager that depends on these comments to
184 download the proper fonts to the printer may not work properly.)
185 </para>
186 <para>
187 Then create a [afmdirs] section in your
188 <filename>wine.conf</filename> (or
189 <filename>~/.wine/config</filename>) and add a line of the form
190 </para>
191 <screen>
192 "dir&lt;n&gt;" = "/unix/path/name/"
193 </screen>
194 <para>
195 for each directory that contains AFM files you wish to use.
196 </para>
197 <para>
198 You also require a PPD file for your printer. This describes certain
199 characteristics of the printer such as which fonts are installed, how
200 to select manual feed etc. Adobe also has many of these on its website,
201 have a look in <ulink url="ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/">
202 ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/</ulink>. See
203 above for information on configuring the driver to use this file.
204 </para>
205 <para>
206 To enable colour printing you need to have the
207 <literal>*ColorDevice</literal> entry in the PPD set to
208 <literal>true</literal>, otherwise the driver will generate
209 greyscale.
210 </para>
211 <para>
212 Note that you need not set <literal>printer=on</literal> in
213 the [wine] section of <filename>wine.conf</filename>, this
214 enables printing via external printer drivers and does not
215 affect the builtin PostScript driver.
216 </para>
217 <para>
218 If you're lucky you should now be able to produce PS files
219 from Wine!
220 </para>
221 <para>
222 I've tested it with win3.1 notepad/write, Winword6 and
223 Origin4.0 and 32 bit apps such as win98 wordpad, Winword97,
224 Powerpoint2000 with some degree of success - you should be
225 able to get something out, it may not be in the right place.
226 </para>
227 </sect3>
229 <sect3>
230 <title>TODO / Bugs</title>
232 <itemizedlist>
233 <listitem>
234 <para>
235 Driver does read PPD files, but ignores all constraints
236 and doesn't let you specify whether you have optional
237 extras such as envelope feeders. You will therefore find
238 a larger than normal selection of input bins in the
239 print setup dialog box. I've only really tested ppd
240 parsing on the <filename>hp4m6_v1.ppd</filename> file.
241 </para>
242 </listitem>
243 <listitem>
244 <para>No TrueType download.</para>
245 </listitem>
246 <listitem>
247 <para>StretchDIBits uses level 2 PostScript.</para>
248 </listitem>
249 <listitem>
250 <para>AdvancedSetup dialog box.</para>
251 </listitem>
252 <listitem>
253 <para>Many partially implemented functions.</para>
254 </listitem>
255 <listitem>
256 <para>ps.c is becoming messy.</para>
257 </listitem>
258 <listitem>
259 <para>
260 Notepad often starts text too far to the left depending
261 on the margin settings. However the win3.1
262 <filename>pscript.drv</filename> (under wine) also does
263 this.
264 </para>
265 </listitem>
266 <listitem>
267 <para>Probably many more...</para>
268 </listitem>
269 </itemizedlist>
271 <para>
272 Please contact me if you want to help so that we can avoid duplication.
273 </para>
274 <para>
275 &name-huw-davies; <email>&email-huw-davies;</email>
276 </para>
277 </sect3>
278 </sect2>
279 </sect1>
281 <!-- Keep this comment at the end of the file
282 Local variables:
283 mode: sgml
284 sgml-parent-document:("wine-doc.sgml" "set" "book" "chapter" "")
285 End: