Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
c# asp.net ---'no printers installed ' error in my web application on clicking print option in crystal report..when running on my server working fine but after publishing to website not functioning in client machine..and no printers are installed in client machine how to code to set a default printer in client machine..


following is my c# code:

C#
protected void print_Click1(object sender, EventArgs e)
        {
            oReport1.Load(Server.MapPath("~/Report/PaySalaryMonthWise.rpt"));


            connection.DoCRLogin(oReport1);

            CrystalReportViewer1.ReportSource = oReport1;
            CrystalReportViewer1.DataBind();
            oReport1.PrintToPrinter(1, false, 0, 0);
        }
Posted
Comments
Dholakiya Ankit 20-Jul-13 6:26am    
detect printer first then go for printing
deepa ashwi 20-Jul-13 6:31am    
@ankit
i am new to it
how to detect printer

You must understand that your ASP.NET/C# code is running on the server machine not on the client! So, when you publish your website to a live server, it's likely that it does not have any printer installer and that's why you get such error. Again, your code is trying to print to a printer installed at the server not at the client.
If you want to print the report to client printers, then try the solutions provided by these links

http://scn.sap.com/thread/2066966[^]

Displaying , Exporting and Printing Crystal Reports in ASP.NET[^]

http://goo.gl/eFSPw[^]

http://scn.sap.com/thread/1227795[^]
 
Share this answer
 
Comments
deepa ashwi 20-Jul-13 7:37am    
@marc..i dont have printers installed in my client machines..so if i code to set default printers to client machine will that work?and how to code to set default printer
Marc Gabrie 21-Jul-13 8:14am    
sorry but I cannot figure out what you want to do at all. Do you want to get the report (rpt) printed to the "Default" printer at the client machine? clarify a bit please. thanks,
deepa ashwi 22-Jul-13 0:10am    
@marc..yes i want the report printed to default printer at client machine..how to code for that..
Marc Gabrie 22-Jul-13 13:17pm    
ok have you taken a look at the links I provided you above? I think the third one has a code for printing to default printer but it uses an utility that needs to be installed at the client + it's not free, sadly. The second link also has a solution but it requires more user intervention. Review those links and let me know.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900