Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 3636

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 added all the printers in the server (shared printers from some users computers) 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" exeption or the tags are printer in the default printer. here is my code:

 

string printername = getPrinter();
       
ReportDocument rd =newReportDocument();
        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 3636

Trending Articles



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