locked
asp.net C# Button Click Crystal Report Will "Print" RRS feed

  • Question

  • User1127247806 posted

    hi frd ,

    can any one help me to print directly without showing crystal report

    thanks.

    Thursday, March 7, 2013 11:44 AM

All replies

  • User-659726541 posted

    it is possible, but you have to use the serverside printing.

    Inside the crystal,

            this.PrintOptions.PrinterName = printerName;
            this.PrintToPrinter(copies, collated, startPage, endPage);

    'printerName' is the printer name installed on the server. you can specify that in the appsettings.local file and access the value here.

    eg:

            string printerName = "MY_PRINTER_NAME";
            this.PrintOptions.PrinterName = printerName;
            this.PrintToPrinter(1, FALSE, 0, 0);

    hope that helps

    Friday, March 8, 2013 1:10 AM
  • User1127247806 posted

    ReportDocument crystalReport = new ReportDocument();
            crystalReport.Load(Server.MapPath("SRMoneyReceipt.rpt"));
            crystalReport.SetDatabaseLogon
                ("", "", @"MONIR-PC\SQLEXPRESS", "afrindb");

            //string fdate = Convert.ToString(Session["fdate"]);
            //string tdate = Convert.ToString(Session["tdate"]);
            // string account = Convert.ToString(Session["villa"]);
            // string ffdate = Convert.ToString(Session["FROMDATE"]);
            // string ttdate = Convert.ToString(Session["TODATE"]);
            string project = Convert.ToString(Session["SRMoney"]);


            crystalReport.SetParameterValue("srno", project);
            // crystalReport.SetParameterValue("frdate", ffdate);
            // crystalReport.SetParameterValue("todate", ttdate);
            // crystalReport.SetParameterValue("proj", project);
            CrystalReportViewer1.ReportSource = crystalReport;

    i use in crystal report where i will write print comman

    Saturday, March 9, 2013 9:39 AM