I want to print from client side attached printer directly, when i am giving print from client side, then print is coming on server printer instead of client printer.
below is my code for printing.
protected void btnprnt_Click(object sender, EventArgs e)
{
if (Convert.ToInt32(txtqty.Text) > 0)
{
try
{
con.Open();
SqlCommand cmd = new SqlCommand("sp_Importlabelprint", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
//SqlDataAdapter adp = new SqlDataAdapter("select prdno,orderno,Codeitem,prdqty from probale", con);
//DataSet ds = new DataSet();
//adp.Fill(ds);
for (int i = 0; i < Convert.ToInt32(txtqty.Text); i++)
{
ReportDocument rpt = new ReportDocument();
rpt.FileName = Server.MapPath("~/Importlbprint.rpt");
rpt.SetDataSource(ds.Tables["Table"]); //DS is Dataset which you want to print
rpt.SetParameterValue("PageNo", i + 1);
rpt.SetParameterValue("TotalPage", Convert.ToInt32(txtqty.Text));
rpt.PrintToPrinter(1, false, 1, 1);
}
string url = "/lbimportprints.aspx?noc=" + txtqty.Text;
Page.ClientScript.RegisterStartupScript(
this.GetType(), "OpenWindow", "window.open('"+url+"','_newtab');", true);
}
catch (Exception ex) { }
}
}