Printer.PrintAction Property
Gets or sets a value that determines whether the print output is directed to a printer, to a print preview window, or to a file.
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
When PrintToPrinter is selected, the print output is directed to the computer's default printer. If no printer is installed an error is raised.
When PrintToPreview is selected, the print output is displayed in a standard PrintPreviewDialog control.
When PrintToFile is selected, the print output is saved to an Encapsulated PostScript file (.eps, .ps, or .ai) in the path specified by the PrintFileName property. If no file name is specified an error is raised. Files are saved in an 8-bit Grayscale PostScript format. 24-bit RGB PostScript is not supported.
Note |
|---|
The user is not prompted for a path or file name extension. To make sure that the file has a valid path and extension, you can implement your own dialog box. To do this, use a SaveFileDialog component and assign the return value to the PrintFileName property before you call the Print method. |
The following table lists the PrintAction values that are valid for the PrintAction property.
Enumeration name | Description |
|---|---|
PrintToFile | The print operation is directed to a file. |
PrintToPreview | The print operation is directed to a print preview dialog box. |
PrintToPrinter | The print operation is directed to a printer. |
Note |
|---|
Functions and objects in the Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 namespace are provided for use by the tools for upgrading from Visual Basic 6.0 to Visual Basic 2010. In most cases, these functions and objects duplicate functionality that you can find in other namespaces in the .NET Framework. They are necessary only when the Visual Basic 6.0 code model differs significantly from the .NET Framework implementation. |
The following example demonstrates how to set the PrintAction property. It requires that you have three RadioButton controls that enable the user to select a printing method.
Dim Printer As New Printer If RadioButton1.Checked = True Then Printer.PrintAction = Printing.PrintAction.PrintToPrinter ElseIf RadioButton2.Checked = True Then Printer.PrintAction = Printing.PrintAction.PrintToPreview Else Printer.PrintFileName = _ My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData _ & "Form1.eps" Printer.PrintAction = Printing.PrintAction.PrintToFile End If
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Note