Quantcast
Channel: Crystal Reports
Viewing all articles
Browse latest Browse all 1507

print to a non default printer

$
0
0

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);
        }




Viewing all articles
Browse latest Browse all 1507

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>