Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

PrintDocument.Print Method (String, PrinterFallbackSettings, Boolean)

Starts the vector printing process for the specified document by optionally opening the print dialog box or printing directly to the default printer for trusted applications.

Namespace:  System.Windows.Printing
Assembly:  System.Windows (in System.Windows.dll)
public void Print(
	string documentName,
	PrinterFallbackSettings printerFallbackSettings,
	bool useDefaultPrinter
)

Parameters

documentName
Type: System.String
The name of the document to print.
printerFallbackSettings
Type: System.Windows.Printing.PrinterFallbackSettings
The settings to use to enable vector printing for printers with limited support.
useDefaultPrinter
Type: System.Boolean
Whether or not to automatically print to the default printer for the computer without showing a print dialog. This parameter can only be true in trusted applications, otherwise an exception will occur.
ExceptionCondition
SecurityException

The print operation is not user-initiated.

-or-

useDefaultPrinter is set to true and the application is not a trusted application.

In Silverlight 5 the printing defaults to vector printing. In Silverlight 4, the printing defaults to bitmap printing. You can specify bitmap printing in Silverlight 5 by using the PrintBitmap method.

Specify the output to print by handling the PrintPage event and by setting the PrintPageEventArgs.PageVisual property to the UIElement you wish to print. If you are printing items that are not in the visual tree, you should populate the UIElement with all its content before setting it to the PrintPageEventArgs.PageVisual.

If the user cancels the print operation, the BeginPrint and EndPrint events will not occur.

Silverlight

Supported in: 5

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.