如何直接跳过印刷的printDocument.print()对话框,并打印网页? [英] How to skip the dialog of printing in printDocument.print() and print page directly?
问题描述
当我使用 MyPrintDocument.print()
在用C#编写Windows应用程序,显示了一个取消按钮在Windows处理打印程序的对话框。我不想显示该对话框,这可能吗?
When I use MyPrintDocument.print()
in a Windows application written in C#, a dialog is shown for the Windows processing print routine with a cancel button. I don't want this dialog shown, is it possible?
如果不是,我应该用哪种方式?我的程序采用的是热敏打印机。
If not, which way should I use? My program uses a thermal printer.
推荐答案
其中<一个href="http://msdn.microsoft.com/en-us/library/system.drawing.printing.printcontroller">PrintController您使用。
.NET框架包括从 PrintController
派生的三个打印控制器,可帮助完成常见任务。该 StandardPrintController
将文档打印到打印机。该 previewPrintController
生成的文件将是什么样子preVIEW打印,并使用由打印previewControl <当/ code>和
打印previewDialog
类。该 PrintControllerWithStatusDialog
在打印过程中提供了打印状态对话框。
The .NET Framework includes three print controllers that are derived from
PrintController
that help accomplish common tasks. TheStandardPrintController
prints a document to a printer. ThePreviewPrintController
generates a preview of what the document will look like when printed and is used by thePrintPreviewControl
andPrintPreviewDialog
classes. ThePrintControllerWithStatusDialog
provides a printing status dialog during the printing process.
这听起来像你正在使用的<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.printcontrollerwithstatusdialog"><$c$c>PrintControllerWithStatusDialog$c$c> PrintController
。
It sounds like you are using the PrintControllerWithStatusDialog
PrintController
.
警告:的我不是在一个位置,以验证基本的 PrintController
不采取行动以同样的方式
Caveat: I am not in a position to verify that the basic PrintController
doesn't act the same way.
根据该<一href="http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/cb78e90b-bf27-462c-90d3-78d935f49ed1">MSDN论坛发帖中的 PrintControllerWithStatusDialog
是默认的:
他建议是这样的:
MyPrintDocument.PrintController = new System.Drawing.Printing.StandardPrintController();
这篇关于如何直接跳过印刷的printDocument.print()对话框,并打印网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!