33

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?

gre_gor
  • 5,546
  • 9
  • 35
  • 41
Krankoloji
  • 337
  • 1
  • 3
  • 5

4 Answers4

64

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.

SeeSharp
  • 2,640
  • 14
  • 15
  • @Krankoloji No problem, glad to have helped! – SeeSharp Apr 01 '11 at 11:25
  • @SeeSharp : This works fine if you are calling printDocument.Print, but not if you call printDocument.DisplayDialog. There is no dialogController equivalent. Any ideas? – Bill Aug 19 '11 at 01:48
  • 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. – gridtrak Apr 23 '18 at 20:09
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
chinto
  • 1,436
  • 17
  • 27
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“.

  • This did have any affect on the issue. Dialog still displays. Windows 10 Enterprise 2016 LTSB all current updates – gridtrak Apr 23 '18 at 19:51
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);

        }
ranojan
  • 647
  • 6
  • 9