Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip the dialog of printing in printDocument.print() and print page directly?

Tags:

c#

.net

winapp

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.

like image 326
hamze Avatar asked May 13 '12 14:05

hamze


People also ask

How do I change the print dialog box?

To display the Print Settings dialog box, click (Down arrow) of the Print button or the Start Printing button in the Preview screen, and select Print Settings.... Alternatively, click (Down arrow) of the Start Printing button in the Edit and Print Clips screen and select Print Settings....

What are the three options available in the print dialog box?

The Print dialog box lets the user select options for a particular print job. For example, the user can specify the printer to use, the range of pages to print, and the number of copies.


1 Answers

Which PrintController are you using.

The .NET Framework includes three print controllers that are derived from PrintController that help accomplish common tasks. The StandardPrintController prints a document to a printer. The PreviewPrintController generates a preview of what the document will look like when printed and is used by the PrintPreviewControl and PrintPreviewDialog classes. The PrintControllerWithStatusDialog provides a printing status dialog during the printing process.

It sounds like you are using the PrintControllerWithStatusDialog PrintController.


Caveat: I am not in a position to verify that the basic PrintController doesn't act the same way.

According to this MSDN Forum Posting the PrintControllerWithStatusDialog is the default:

He suggests something like this:

MyPrintDocument.PrintController = new System.Drawing.Printing.StandardPrintController();
like image 64
Mark Hall Avatar answered Oct 09 '22 10:10

Mark Hall