我可以禁用打印第 x 页(共 y 页)对话框吗?

发布于 2024-10-28 03:49:33 字数 310 浏览 1 评论 0原文

我正在使用 C# 开发一个全屏信息亭应用程序。我需要打印门票和收据。我使用 PrintDocument 类进行打印。打印机打印完美,但我需要禁用打印期间显示的弹出对话框。

screenshot

我听说可以通过控制面板中的打印机和传真来禁用它,但我在控制面板中没有打印机和传真。

我可以禁用显示的对话框吗?如果可以的话我该怎么做?

I am developing a full screen kiosk application using c#. I need to print tickets and receipts. I use the PrintDocument class for the printing. Printer prints perfectly, but i need to disable the pop-up dialog shown during printing.

screenshot

I heard it can be disabled with Printers and Faxes in control panel, but i do not have Printers and Faxes in control panel.

Can i disable the dialog shown? If i could, how can i do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

记忆之渊 2024-11-04 03:49:33

我相信将 PrintDocumentPrintController 设置为 StandardPrintController 应该可以解决这个问题。

PrintDocument printDocument = new PrintDocument();
PrintController printController = new StandardPrintController();
printDocument.PrintController = printController;

希望这对一些人有帮助。

I believe setting your PrintDocument's PrintController to StandardPrintController should solve this.

PrintDocument printDocument = new PrintDocument();
PrintController printController = new StandardPrintController();
printDocument.PrintController = printController;

Hope this helps some.

淡忘如思 2024-11-04 03:49:33

很好的问题和答案。这是 VB.Net 版本,谷歌搜索 vb.net 没有返回任何有意义的结果。

  Dim printDocument As New System.Drawing.Printing.PrintDocument
  Dim printController As New System.Drawing.Printing.StandardPrintController
  printDocument.PrintController = printController

Great question and answer. Here is the VB.Net version googling for vb.net wasn't returning any meaningful results.

  Dim printDocument As New System.Drawing.Printing.PrintDocument
  Dim printController As New System.Drawing.Printing.StandardPrintController
  printDocument.PrintController = printController
无妨# 2024-11-04 03:49:33

Windows 10、8、7 和服务器2012
注意:此选项在 Windows 家庭版中不可用。

按住 Windows 键,然后按“R”调出 Windows 运行对话框。
输入“printmanagement.msc”,然后按“Enter”。
展开“打印机服务器”,然后右键单击计算机名称并选择“打印机服务器属性”。
选择“高级”选项卡。
取消选中“显示本地打印机的信息通知”和“显示网络打印机的信息通知”。

Windows 10, 8, 7, & Server 2012
Note: This option is not available in the Home versions of Windows.

Press and hold the Windows Key, then press “R” to bring up the Windows Run dialog box.
Type “printmanagement.msc“, then press “Enter“.
Expand “Printer Servers“, then right click the name of the computer and select “Printer Server Properties“.
Select the “Advanced” tab.
Uncheck “Show Informational Notifications for Local Printers” and “Show Informational Notifications for Network Printers“.

街角卖回忆 2024-11-04 03:49:33

这对我有用。你可以试试这个

PrintDocument document = new PrintDocument();
        PrintDialog dialog = new PrintDialog();
        PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();
        private  Font printFont;
        private string stringToPrint;
      //  private int linesPerPage=9;
        private Font printFont1;
        QRCode qrCode1;
        private string stringToPrint1;
        private string databasePath;
        int i=1;
        public Form1()
        {
            InitializeComponent();


            //document.DefaultPageSettings.PrinterSettings.PrinterName = "GODEX500";
            //  document.DefaultPageSettings.Landscape = true;
            document.DefaultPageSettings.PaperSize = new PaperSize("75 x50 mm", 300, 200);
            document.DefaultPageSettings.Margins = new Margins(1, 1, 1, 1);
            printFont = new Font("Arial", 10);
            // printFont1 = new Font("NewBarcodeFont", 12);

            //    document= new Font("GODEX-NewBarcodeFont", 12, FontStyle.Regular);
            // document.OriginAtMargins = true;
            //This PrintController worked fine and not showing printing this document using window
            PrintController printController = new StandardPrintController();
            document.PrintController = printController;
            document.PrintPage += new PrintPageEventHandler(document_PrintPage);

        }

This Worked for me. You can try this

PrintDocument document = new PrintDocument();
        PrintDialog dialog = new PrintDialog();
        PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();
        private  Font printFont;
        private string stringToPrint;
      //  private int linesPerPage=9;
        private Font printFont1;
        QRCode qrCode1;
        private string stringToPrint1;
        private string databasePath;
        int i=1;
        public Form1()
        {
            InitializeComponent();


            //document.DefaultPageSettings.PrinterSettings.PrinterName = "GODEX500";
            //  document.DefaultPageSettings.Landscape = true;
            document.DefaultPageSettings.PaperSize = new PaperSize("75 x50 mm", 300, 200);
            document.DefaultPageSettings.Margins = new Margins(1, 1, 1, 1);
            printFont = new Font("Arial", 10);
            // printFont1 = new Font("NewBarcodeFont", 12);

            //    document= new Font("GODEX-NewBarcodeFont", 12, FontStyle.Regular);
            // document.OriginAtMargins = true;
            //This PrintController worked fine and not showing printing this document using window
            PrintController printController = new StandardPrintController();
            document.PrintController = printController;
            document.PrintPage += new PrintPageEventHandler(document_PrintPage);

        }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文