  <sect1 id="config-printing">
    <title>Printing in Wine</title>
    <para>How to print documents in Wine...</para>

    <sect2 id="config-printing-intro">
      <title>Printing</title>

      <para>
        Printing in Wine can be done using the built-in Wine PostScript driver (+ ghostscript to produce
        output for non-PostScript printers).
      </para>
      <para>
        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.
      </para>

      <sect3>
        <title>Built-in Wine PostScript driver</title>
        <para>
          Enables printing of PostScript files via a driver built into Wine. See
          below for installation instructions. The code for the PostScript
	  driver is in <filename>dlls/wineps/</filename>.
        </para>
	<para>
	  The driver behaves as if it were a DRV file called
	  <filename>wineps.drv</filename> 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.
	</para>
      </sect3>

      <sect3>
        <title>Spooling</title>
        <para>
          Spooling is rather primitive. The [spooler] section of
          the wine config file maps a port (e.g.
          <systemitem>LPT1:</systemitem>) to a file or a command via a pipe. For
          example the following lines
        </para>
        <screen>
"LPT1:" = "foo.ps"
"LPT2:" = "|lpr"
        </screen>
        <para>
          map <systemitem>LPT1:</systemitem> to file <filename>foo.ps</filename>
          and <systemitem>LPT2:</systemitem> to the <command>lpr</command>
          command. If a job is sent to an unlisted port, then a file is created
          with that port's name; e.g. for <systemitem>LPT3:</systemitem> a file
          called <systemitem>LPT3:</systemitem> would be created.
        </para>
	<para>
	  There are now also virtual spool queues called
	  <systemitem>LPR:printername</systemitem>, which send the data
	  to <command>lpr -Pprintername</command>. You do not need to
	  specify those in the config file, they are handled automatically by
	  <filename>dlls/gdi/printdrv.c</filename>.
	</para>
      </sect3>
    </sect2>

    <sect2 id="config-printing-psdriver">
      <title>The Wine PostScript Driver</title>

      <para>
        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.
      </para>

      <sect3>
        <title>Installation</title>
	<sect4>
	  <title>Installation of CUPS printers</title>
	  <para>
	    If you are using CUPS, you do not need to configure .ini or
	    registry entries, everything is autodetected.
	  </para>
	</sect4>
	<sect4>
	  <title>Installation of LPR /etc/printcap based printers</title>
	  <para>
	    If your system is not yet using CUPS, it probably uses LPRng
	    or a LPR based system with configuration based on <filename>/etc/printcap</filename>.
	  </para>
	  <para>
	    If it does, your printers in <filename>/etc/printcap</filename>
	    are scanned with a heuristic whether they are PostScript capable
	    printers and also configured mostly automatic.
	  </para>
	  <para>
	    Since Wine cannot find out what type of printer this is, you
	    need to specify a PPD file in the [ppd] section of
	    <filename>~/.wine/config</filename>. Either use the shortcut
	    name and make the entry look like:
	  </para>
	  <screen>
	    [ppd]
	    "ps1" = "/usr/lib/wine/ps1.ppd"
	  </screen>
	  <para>
	    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
	    <filename>documentation/samples/generic.ppd</filename>.
	  </para>
	</sect4>
	<sect4>
	  <title>Installation of other printers</title>
	  <para>
	    You do not need to do this if the above 2 sections apply, only if
	    you have a special printer.
	  </para>
	  <screen>
  Wine PostScript Driver=WINEPS,LPT1:
	  </screen>
	  <para>
	    to the [devices] section and
	  </para>
	  <screen>
  Wine PostScript Driver=WINEPS,LPT1:,15,45
	  </screen>
	  <para>
	    to the [PrinterPorts] section of <filename>win.ini</filename>,
	    and to set it as the default printer also add
	  </para>
	  <screen>
  device = Wine PostScript Driver,WINEPS,LPT1:
	  </screen>
	  <para>
	    to the [windows] section of <filename>win.ini</filename>.
	  </para>
	  <para>
	    You also need to add certain entries to the registry.
	    The easiest way to do this is to customize the PostScript
	    driver contents of <filename>wine.inf</filename> (see below) and use the
	    Winelib program <command>programs/regedit/regedit</command>.  For
	    example, if you have installed the Wine source tree in
	    <filename>/usr/src/wine</filename>, you could use the following
	    series of commands:
	    <itemizedlist>
	      <listitem>
		<para>
		  <userinput>#vi /usr/share/wine/wine.inf</userinput>
		</para>
	      </listitem>
	      <listitem>
		<para>
		  Edit the copy of <filename>wine.inf</filename> to suit your
		  PostScript printing requirements.
		  At a minimum, you must specify a PPD file for each printer.
		</para>
	      </listitem>
	      <listitem>
		<para>
		  <userinput>$wineprefixcreate</userinput>
		</para>
	      </listitem>
	    </itemizedlist>
	  </para>
	</sect4>
	<sect4>
	  <title>Required configuration for all printer types</title>
	  <para>
	    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 built-in.
	  </para>
	  <para>
	    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
	    <ulink url="ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/">
	    ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/</ulink>.
	    See above for information on configuring the driver to use this
	    file.
	  </para>
	  <para>
	    To enable colour printing you need to have the
	    <literal>*ColorDevice</literal> entry in the PPD set to
	    <literal>true</literal>, otherwise the driver will generate
	    greyscale.
	  </para>
	  <para>
	    Note that you need not set <literal>printer=on</literal> in
	    the [wine] section of the wine config file, this
	    enables printing via external printer drivers and does not
	    affect the built-in PostScript driver.
	  </para>
	  <para>
	    If you're lucky you should now be able to produce PS files
	    from Wine!
	  </para>
	  <para>
	    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.
	  </para>
	</sect4>
      </sect3>

    </sect2>
  </sect1>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-parent-document:("wine-user.sgml" "set" "book" "chapter" "")
End:
-->
