I am making an asp.net where users supposed to print tags after doing their works. the tags are crystal reports based. I instaled all the printers in the server and i have a method return the nearest available printer to the user. the probleme is unless the printer is set as default printer to the server i have a "no printer are installed" or the tags are simply printed to the default printer not the chosen one. here is my code:
string printername = getPrinter(); ReportDocument rd = new ReportDocument(); rd.PrintOptions.PrinterName = printername; rd.Load(Server.MapPath("../GFile/TAG.rpt")); rd.PrintOptions.PrinterName = printername; rd.SetDataSource(sd); int number = int.Parse(tbxNumTaG.Text); try { rd.PrintToPrinter(number, false, 0, 0); } catch(Exception ex) { Page.ClientScript.RegisterStartupScript(GetType(), "printer Problems", "alert('" + ex.Message + " " + printername + "Your associated printer not working contact the admin!');", true); }