Hello, I am doing a C# win. application, and using crystal report for printing bills on a custom paper size The width of the paper is unknown (the program has to get the paper size - if this is possible), the lenth of the paper is infinitive (its a roll paper).
What and how I do it, that the report it will be printed out?
The report is filled up with all the data needed, and the code already gets the printer name, ... so what now?
- How to get the paper width and print the report (the report was made that all goes onto such paper width)?
- And that the printer will stop puting the paper out the it when the report is printed?
This code I have now, and I didnt test it yet, so I am not sure if it will work:
string printerName = GetPrinterName();
if (printerName != null)
{
cr.PrintOptions.PaperSource = PaperSource.Auto;
cr.PrintOptions.PaperSize = PaperSize.DefaultPaperSize;
CrystalDecisions.Shared.PageMargins edges = new CrystalDecisions.Shared.PageMargins(1, 1, 1, 1);
cr.PrintOptions.ApplyPageMargins(edges);
crystalReportViewer1.ReportSource = cr;
crystalReportViewer1.Refresh();
cr.PrintOptions.PrinterName = printerName;
cr.PrintToPrinter(1, false, 0, 0);
}