Can I disable the printing page x of y dialog?
Asked Answered
A

4

35

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?

Affix answered 1/4, 2011 at 8:54 Comment(0)
Z
68

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.

Zeena answered 1/4, 2011 at 10:5 Comment(3)
@Affix No problem, glad to have helped!Zeena
@Zeena : This works fine if you are calling printDocument.Print, but not if you call printDocument.DisplayDialog. There is no dialogController equivalent. Any ideas?Sankey
This did not do anything to prevent the Paging pop-up dialog. Visual Studio 2017 C# .NET Framework 4.6.2, Windows 10 Ent 2016 LTSP.Paronomasia
L
5

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
Loella answered 5/3, 2012 at 7:50 Comment(0)
S
1

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

Salters answered 10/1, 2018 at 20:9 Comment(1)
This did have any affect on the issue. Dialog still displays. Windows 10 Enterprise 2016 LTSB all current updatesParonomasia
I
0

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

        }
Input answered 13/11, 2018 at 10:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.