1
votes

I need to print a receipt on thermal paper from Crystal Reports. I created a print layout which works fine if printed from the preview. If I try to print from code, the printer just rolls out empty paper. The printer is installed properly (POS58). How can I properly print this from code?

ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Directory.GetCurrentDirectory() + @"\Reports\receipt.rpt");
rptDoc.SetParameterValue("pOrderID",OrderID);
rptDoc.PrintOptions.PrinterName = "POS58";
rptDoc.PrintToPrinter(1,false,0,0);

enter image description here

enter image description here

1
Hi Guys, Is any idea? - Zoltan

1 Answers

1
votes

Since I can't comment on your question, I am going to ask you here: Do you have any data on the report to show? I don't see any datasource assignment in your code, so maybe you need to provide some data to be printed.

Have you tried setting the paperSize in your code using the PrintOption in your report? I did this once; I was printing to a receipt printer but my paper was set to A4 so my actual report data were printed outside of the receipt paper. Try to send your document to a printer with A4 paper or better yet send it to oneNote so you don't waste paper and see how it prints.