Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
Hi,
I have some byte data in an array.  I need to print it directly to the printer, without shoiwng print dialogue box.  Please give me code sample how to avoid the dialogue box.

Thanks
Posted

See An absolute beginner's guide to printing in .NET[^]

Printing in .NET follows the overview of the print system quite closely. There are two main framework classes that you use to do all your work with printing, which are in the System.Drawing.Printing namespace: PageSettings, which is used for such things as selecting the paper size and page orientation, and PrintDocument, which is used to do the printing operation itself.

Arguably, the best way of implementing a custom print operation in .NET is to create your own class that holds a private variable that is of type PrintDocument and write the code to perform the printing in the event handlers of that class to print the desired document. I will discuss these in the order in which they occur in the life of a print operation.
 
Share this answer
 
MS has some code for doing that here http://support.microsoft.com/kb/322090[^]
 
Share this answer
 
Comments
Michael_Davies 29-Aug-21 12:47pm    
Hi Marc,
Microsoft have either taken down or moved the article, here is the Codeproject link to an article with the code;

https://www.codeproject.com/Tips/704989/Print-Direct-To-Windows-Printer-EPOS-Receipt

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900