CD_PRINTER - Printer Driver (cdprint.h)

This driver provides access to a System Default Printer.

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 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 Flush to change to a new page. You can draw first on page 1, then on page 2 and so forth.

To use this driver in Windows using GDI+ is necessary to call cdUseContextPlus(1) before creating the canvas.

Behavior of Functions

This driver is greatly platform-dependent. For further detail, see the Behavior of Functions in each platform: Microsoft Windows (GDI), Windows Using GDI+, and Cairo (over GDK). 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

Attributes

Exclusive Attributes

Notes

Patterns

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 wdCanvasPattern 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.

But on some printers the result were not what we expect: