Print Page | Close Window

setting print height in crystal report

Printed From: Crystal Reports Book
Category: General Information
Forum Name: Talk with the Author
Forum Discription: Ask Brian questions about his books and give him your comments. Like the book? Hate the book? Have suggestions? Let me know!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=17011
Printed Date: 28 Apr 2024 at 11:15am


Topic: setting print height in crystal report
Posted By: RahulGiridharan
Subject: setting print height in crystal report
Date Posted: 12 Jul 2012 at 2:08am
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



Print Page | Close Window