private void crystalrep()
{
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath("~/Reports/CRDischarge.rpt"));
// PaperSize p1 = new PaperSize();
rptDoc.SetParameterValue("Name", lbname.Text);
rptDoc.SetParameterValue("BillNo", Lbbillno.Text);
rptDoc.SetParameterValue("Total", Lbtotalamnt.Text);
rptDoc.SetParameterValue("RoomNo", txtroomnumber.Text);
rptDoc.SetParameterValue("BedNo", txtbednumber.Text);
rptDoc.SetParameterValue("Rent", lbrent.Text);
rptDoc.SetParameterValue("Pharma", lbpharmaamnt.Text);
rptDoc.SetParameterValue("Lab", lblabamnt.Text);
rptDoc.SetParameterValue("Xray", lbxrayamnt.Text);
rptDoc.SetParameterValue("Add", lbaddit.Text);
// rptDoc.PrintOptions.PrinterName = "WeP CSX 450";
rptDoc.PrintOptions.PaperSource = PaperSource.Auto;
rptDoc.PrintOptions.PaperSize = PaperSize.DefaultPaperSize;
CrystalDecisions.Shared.PageMargins edges = new CrystalDecisions.Shared.PageMargins(1, 1, 1, 1);
rptDoc.PrintOptions.ApplyPageMargins(edges);
CrystalReportViewer1.ReportSource = rptDoc;
//CrystalReportViewer1.Refresh();
CrystalReportViewer1.ReportSource = rptDoc;
rptDoc.PrintOptions.PrinterName = "WeP CSX 450";
rptDoc.PrintToPrinter(1, false, 0, 0);
}
Am ussing this code to print ma crystal report in webforms application....but its printngin a4 page height..how can i stop the printer just after the content in the report is over....actually am printng in a roll paper for billing application..the height of paper may increase according to number of items purchased...thanks
|