0
votes

http://avas.hexaperkeducation.com/demo/Default.aspx

i built this application which print crystal report directly to printer.its working fine on my local system but when i upload it to online server page load keep running .

 con.Open();
 string sql = "select * from Student_Master";
 System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(sql, con);
 DataSet ds = new DataSet();
 da.Fill(ds, "Student_Master");
 ReportDocument Report = new ReportDocument();
 Report.Load(Server.MapPath("CrystalReport.rpt"));
 Report.SetDataSource(ds);
 CrystalReportViewer1.ReportSource = Report;
 CrystalReportViewer1.DataBind();

 Report.PrintToPrinter(1, true, 1, 1);
1

1 Answers

0
votes

Which version of crystal reports runtime you are using on server and on local system? Runtime should be 32bit. You need to setup those two properties.

Report.PrintOptions.NoPrinter = false;
Report.PrintOptions.PrinterName = <printername>;

And printer should be available in network via this name. If you are using IIS then application pool also need access to printer. In app pool advanced settings you need to switch boolean prop "Enable 32-bit apps" to true. If this still does not help you can try change Identity to "LocalService" in those advanced settings.