CD - Canvas Draw

Printer Driver (cdprint.h)

This driver provides access to a System Default Printer. Currently, it works only in platforms Microsoft Windows and Macintosh, 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 cdCreateCanvas will return NULL.


Use

The canvas is created by calling function cdCreateCanvas(CD_PRINTER, Data), after which other CD functions can be called as usual. The Data string has the following format:

''name [-d]'' or in C style "%s -d"

Name is an optional document name that will appear in the printer queue. Optionally, -d 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.

Any amount of such canvases may exist simultaneously. It is important to note that a call to function cdKillCanvas is required to properly send the data to the printer.

Pages - Use cdFlush to change to a new page. You can draw first on page 1, then on page 2 and so forth.


Behavior of Functions

This driver is greatly platform-dependent. For further detail, see the Behavior of Functions in each platform: Macintosh (QuickDraw), Microsoft Windows (GDI), Windows Using GDI+, X-Windows (XLIB). However, it should be noted that some functions behave differently from the basic functions of each platform.

A printer created in Win32s has the same limitations as the WMF driver. In Windows 95 or NT, it has the same limitations as the EMF driver.

Control

  • cdFlush: changes to a new page, preserving the previous one. In the Win32 base driver, after the first page, function cdText draws the text below its correct position - we do not know why this happens.