Windows-Based Printing
In the old days, programmers had to worry about configuring their applications for dozens of printers. Windows makes life easier because it provides all of the printer drivers you'll ever need. It also supplies a consistent user interface for printing.
Standard Printer Dialog Boxes
When the user chooses Print from the File menu of a Windows-based application, the standard Print dialog box appears, as shown in Figure 17-1.

Figure 17-1: The standard Print dialog box.
If the user clicks the Properties button in the Print dialog box, the Document Properties dialog box appears, as shown in Figure 17-2.

Figure 17-2: The Document Properties dialog box.
During the printing process, the application displays a standard printer status dialog box.
Interactive Print Page Selection
Chapter 16? Let's say the list includes 1000 student names and the user wants to print page 5 of a student report. If each student record requires one print line and a page holds 50 lines, page 5 will include records 201 through 250. With an MFC list collection class, you're stuck iterating through the first 200 list elements before you can start printing. Maybe the list isn't the ideal data structure. How about an array collection instead? With the CObArray class (or one of the template array classes), you can directly access the 201st student record.Not every application has elements that map to a fixed number of print lines. Suppose the student record contains a multi-line text biography field. You can't know how many biography lines each record includes, so you have to search through the entire file to determine the page breaks. If your program can remember those page breaks as it calculates them, its efficiency will increase.
Display Pages vs. Printed Pages
In many cases, you'll want a printed page to correspond to a display page. You cannot guarantee that objects will be printed exactly as they're displayed on screen, but with TrueType fonts, your printed page will be pretty close. If you're working with full-size paper and you want the corresponding display to be readable, you'll certainly want a display window that's larger than the screen. Thus, a scrolling view such as the one that the CScrollView class provides is ideal for your printable views.At other times, you might not care about display pages. Perhaps your view holds its data in a list box, or maybe you don't need to display the data at all. In these cases, your program can contain stand-alone print logic that simply extracts data from the document and sends it to the printer. Of course, the program must properly respond to a user's page-range request. If you query the printer to determine the paper size and orientation (portrait or landscape), you can adjust the pagination accordingly.