VC++ 6.0 ebook chapter index
Free counters!

Chapter 13

Using the Printer

The concept of device independence may have seemed all well and good when we were using the video display for text and graphics. But how well does the concept hold up for printers?

In general, the news is good. From a Microsoft Windows program, you can print text and graphics on paper using the same GDI functions that we've been using for the video display. Many of the issues of device independence that we've explored earlier in this book—mostly related to the size and resolution of the display surface and its color capabilities—can be approached and resolved in the same way. Yet a printer is not simply a display that uses paper rather than a cathode-ray tube. There are some significant differences. For example, we have never had to consider the problem of a video display not being connected to the display adapter or the problem of the display "running out of screen," but it is common for a printer to be off line or to run out of paper.

Nor have we worried about the video display adapter being incapable of performing certain graphics operations. Either the display adapter can handle graphics or it can't. And if it can't, then it can't be used with Windows at all. But some printers can't print graphics (although they can still be used with Windows), and plotters can do vector graphics but have a real problem with bitmaps.

Here are some other issues to consider:

To add printer support to the rest of GDI, Windows provides several functions that apply only to printers. These printer-specific functions—StartDoc, EndDoc, StartPage, and EndPage—are responsible for organizing the printer output into pages. A program continues to call the normal GDI function calls to display text and graphics on a page in the same way as they display on the screen.

Chapters 15, 17, and 18 have additional information on printing bitmaps, formatted text, and metafiles.