Basic Printing

Although WPF includes dozens of print-related classes (most of which are found in the System.Printing namespace), there's a single starting point that makes life easy: the PrintDialog class.

The PrintDialog wraps the familiar Print dialog box that lets the user choose the printer and a few other standard print options, such as the number of copies (Figure 20-1). However, the PrintDialog class is more than just a pretty window—it also has the built-in ability to trigger a printout.

To submit a print job with the PrintDialog class, you need to use one of two methods:

  • PrintVisual() works with any class that derives from System.Windows.Media.Visual. This includes any graphic you draw by hand and any element you place in a window. ...

Get Pro WPF in C# 2008: Windows Presentation Foundation with .NET 3.5, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.