Chapter 13-- Using the Printer

Chapter 13

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:

  • Printers are slower than video displays. Although we have on occasion tried to tune our programs for best performance, we haven't worried much about the time required for the video display to be refreshed. But nobody wants to wait for a slow printer to finish printing before getting back to work.

  • Programs reuse the surface of the video display as they overwrite previous display output with new output. This can't be done on a printer. Instead, a printer must eject a completed page and go on to the next page.

  • On the video display, different applications are windowed. On a printer, output from different applications must be separated into distinct documents or print jobs.

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.



Programming Windows
Concurrent Programming on Windows
ISBN: 032143482X
EAN: 2147483647
Year: 1998
Pages: 112
Authors: Joe Duffy

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net