PrinterName Property  
 

Gets and sets the name of the printer used when printing a document without displaying the print dialog.

Syntax

object.PrinterName [= value ]

Remarks

The PrinterName property specifies the name of the printer used when printing a document without displaying the print dialog. The printer name must correspond to a printer installed and configured in Windows. You should not assume that a printer's model name was used when the printer was configured. If this property has not been set, or is set to an empty string, the default Windows printer is used.

This property is used only when the PrintDialog property is False. When PrintDialog is True, the WebView2 runtime displays its standard print dialog, allowing the user to select a printer and configure printing options. In this case, the PrinterName property is ignored.

The WebView control does not verify that the specified printer exists, is available, or is ready to print before submitting the print request. Applications are responsible for ensuring that the printer is correctly configured and available. Successfully submitting a print request does not guarantee that the document has been printed.

The standard Windows printer selection dialog allows users to select an installed printer. For example, Visual Basic 6.0 applications can use the Microsoft Common Dialog Control and its ShowPrinter method, while other development environments may provide similar printer selection components. Applications can also use the Windows printing APIs, such as EnumPrinters to enumerate available printers and OpenPrinter to validate a printer name. These approaches can be used to obtain a valid printer name before assigning it to the PrinterName property.

This property applies only when printing to a physical printer and has no effect when saving a document in PDF format.

Data Type

String

See Also