Click here to Skip to main content
15,917,456 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i create a customer receipt using PrintDocument in c# winform now i want to make a button and when the button is click then all the pages directly goes to the printer(
A text Box contain printer name  then use this
) without showing print preview dialogue ,
please tell me how can i do this
thanks in Advance

What I have tried:

i try this but it always show print privew dilouge but i dont need printprivew dialouge i want print directly send to the printer
private void button7_Click(object sender, EventArgs e)

{
printPreviewDialog1.Document = printDocument1;
              printPreviewDialog1.ShowDialog();

}
Posted
Updated 30-Jan-19 19:47pm

1 solution

So just call the PrintDocument.Print Method (System.Drawing.Printing) | Microsoft Docs[^] instead of specifically showing the print preview.
 
Share this answer
 
Comments
Fahid Zahoor 31-Jan-19 4:54am    
please tell me if i have moew the one page then PrinDocument.Print(); is ablicable or Not
OriginalGriff 31-Jan-19 5:12am    
Yes, it uses the same code as Print Preview, just with a different destination.
Fahid Zahoor 31-Jan-19 5:27am    
ok i try with this code PrinDocument.Print(); if any problem occur then i will share with you
OriginalGriff 31-Jan-19 5:34am    
No, PrintDocument is a class - you need an instance.
printDocument1.Print();
Should do it.
Fahid Zahoor 31-Jan-19 5:35am    
yes you right i understadn now

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