<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>CD_PRINTER</title> <link rel="stylesheet" type="text/css" href="../../style.css"> </head> <body> <h2 style="text-align: left">CD_PRINTER - Printer Driver (cdprint.h)</h2> <p>This driver provides access to a System Default Printer. </p> <p>Currently, it works only in Microsoft Windows platforms, but it is possible to use it in other platforms without the risk of compilation error. If you attempt to create a canvas in another platform, the function <a href="../func/init.html#cdCreateCanvas"> <font face="Courier"><strong>cdCreateCanvas</strong></font></a> will return NULL.</p> <h3>Use</h3> <p>The canvas is created by calling function <font face="Courier"> <a href="../func/init.html#cdCreateCanvas"> <strong>cdCreateCanvas</strong></a>(CD_PRINTER, Data)</font>, after which other CD functions can be called as usual. The <font face="Courier">Data</font> string has the following format:</p> <pre><span style="background-color: #CEE7FF">"</span><i>name </i>[-d]" <em> or in C style "</em><em><strong><tt>%s -d</tt></strong></em><em>"</em></pre> <p><font face="Courier">name</font> is an optional document name that will appear in the printer queue. Optionally, <font face="Courier">-d</font> displays the System Printer dialogue box before starting to print, allowing you to configure the printer's parameters. When using this parameter and the return canvas is NULL, one must assume that the print was canceled by the user.</p> <p>Any amount of such canvases may exist simultaneously. It is important to note that a call to function <a href="../func/init.html#cdKillCanvas"> <font face="Courier"><strong>cdKillCanvas</strong></font></a> is required to properly send the data to the printer.</p> <p><b>Pages -</b> Use <a href="../func/control.html#cdFlush"> <font face="Courier"><strong>Flush</strong></font></a> to change to a new page. You can draw first on page 1, then on page 2 and so forth.</p> <p>To use this driver in Windows using GDI+ is necessary to call <font face="Courier"><strong> cdUseContextPlus</strong></font><strong><font face="Courier">(1)</font></strong> before creating the canvas.</p> <h3>Behavior of Functions</h3> <p>This driver is greatly platform-dependent. For further detail, see the <b> Behavior of Functions</b> in each platform: <a href="win32.html">Microsoft Windows (GDI)</a>, <a href="gdiplus.html">Windows Using GDI+</a>, <a href="xwin.html">X-Windows (XLIB)</a>. However, it should be noted that some functions behave differently from the basic functions of each platform.</p> <p>A printer created in Win32s has the same limitations as the <a href="wmf.html">WMF driver</a>. In Windows 95 or NT, it has the same limitations as the <a href="emf.html">EMF driver</a>.</p> <h4>Control</h4> <ul> <li> <a href="../func/control.html#cdFlush"> <font face="Courier"><strong>Flush</strong></font></a>: changes to a new page, preserving the previous one. In the Win32 base driver, after the first page, function <font face="Courier"><strong>cdText</strong></font> draws the text below its correct position - we do not know why this happens.</li> </ul> <h4>Attributes </h4> <ul> <li> <a href="../func/filled.html#cdHatch"> <font face="Courier"><strong>Hatch</strong></font></a>: opaque in Win32 base driver (GDI).</li> </ul> <h4>Exclusive Attributes</h4> <ul> <li><strong><font face="Courier">"PRINTERNAME"</font></strong>: Returns the name of the selected printer.</li> </ul> <h3>Notes</h3> <h4>Patterns</h4> <p>Usually when printing regions filled with patterns you have to compensate for the printer high resolution or the pattern will come out very small. If you don't want to create a high resolution version of your pattern, then the simplest way is to use <strong>wdCanvasPattern</strong> to resize the pattern to an expected millimeter size. This will increase the pattern raster size so it will be more visible in the printer.</p> <p>But on some printers the result were not what we expect:</p> <ul> <li> Laser printers automatically increase the real size of the pattern, so it seems that <strong>wdCanvasPattern</strong> is not necessary on those printers.</li> <li> PDF and Postscript based printer drivers (like Adobe PDF Creator and CutePDF Writer) need that the pattern has a width multiple of 8, if not they will appear distorted with an increasing horizontal shift on every line. This does NOT applies to the CD_PDF or CD_PS drivers.</li> </ul> </body> </html>