Can I disable the printing page x of y dialog?

走远了吗. 提交于 2019-12-18 03:01:45

问题


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.

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?


回答1:


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.




回答2:


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



回答3:


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“.




回答4:


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);

        }


来源:https://stackoverflow.com/questions/5511138/can-i-disable-the-printing-page-x-of-y-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!