Printing and Print Preview
MFC supports printing and print preview for your program's documents via class CView. For basic printing and print preview, simply override your view class's OnDraw member function, which you must do anyway. That function can draw to the view on the screen, to a printer device context for an actual printer, or to a device context that simulates your printer on the screen.
You can also add code to manage multipage document printing and preview, to paginate your printed documents, and to add headers and footers to them.
This family of articles explains how printing is implemented in the Microsoft Foundation Class Library (MFC) and how to take advantage of the printing architecture already built into the framework. The articles also explain how MFC supports easy implementation of print preview functionality and how you can use and modify that functionality.