简体   繁体   English

使用 System.WIndows.Forms.WebBrowser 控件打印

[英]Printing with the System.WIndows.Forms.WebBrowser control

I'm using th WebBrowser control in the .net 2.0 framework.我在 .net 2.0 框架中使用了 WebBrowser 控件。 Is it possible to change the printing behavior so it always prints to the default printer, without showing any dialog to the user?是否可以更改打印行为,使其始终打印到默认打印机,而不向用户显示任何对话框? This is for a kiosk so there will always be a printer directly connected to the Kiosk, and printing should be seemless to the user.这是针对自助服务终端的,因此总是有一台打印机直接连接到自助服务终端,并且打印对用户来说应该是无缝的。

Get the default PrinterName using the method shown here http://msdn.microsoft.com/en- us/library/system.drawing.printing.printersettings.isdefaultprinter.aspx获取使用所示的方法,这里默认的PrinterName http://msdn.microsoft.com/en- 我们/库/ system.drawing.printing.printersettings.isdefaultprinter.aspx

and then pass that name to the PrinterSettings property of the PrintDocument.然后将该名称传递给 PrintDocument 的 PrinterSettings 属性。

Simply use the WebBroser.Print() method.只需使用 WebBroser.Print() 方法。
I've used it before and it directly prints to the default printer.我以前用过它,它直接打印到默认打印机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM