C# .NET - Printing - Asked By suresh kotte on 20-May-12 10:40 AM


       I am fresher, and I have making billing application, but i don't know how to write the code for Bill of printing. So plz best reply to me and send a best example.

Thanks &Regards

kalpana aparnathi replied to suresh kotte on 20-May-12 01:31 PM

Use below referance for getting discussion of the pos billing printing.


[)ia6l0 iii replied to suresh kotte on 20-May-12 01:38 PM
One way is to use report designer's such as Crystal Reports. You should build the custom views/reports using the designer and then print them.

Read more on how to print from MSDN article that talks about the "System.Drawing.Printing Namespace"

Also, note that there is the PrintPageEventHandler which allows you to custom write Images or sections of text during print. Look for detailed sample on the internet.  Here is a brief sample I have. 

//invoke the print document's print method.
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);

//the print page event handler.
//print image

ev.Graphics.DrawImage(Image.FromFile("image file path"), ev.Graphics.VisibleClipBounds);

Hope this helps.
Somesh Yadav replied to suresh kotte on 21-May-12 12:22 AM
check this,
Jitendra Faye replied to suresh kotte on 29-May-12 12:37 AM
If you are using crystal report to display report then you can simply use PrintToPrinter() method.

like this-

crReportDocument.PrintOptions.PrinterName = PrinterName;

crReportDocument.PrintToPrinter(1, false, 0, 0);

TRy this and let me know.