TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Akhter HUssain
720
1.3k
102.2k
Print on client side default print.
Sep 17 2019 12:21 AM
i am using below code for printing multiple copies directly without preview,after publishing this code ,it is not printing on client default printer ,and throughing print on server printer instead of client print, here is my code please guide..i want to print label on client default printer.
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) { }
}
}
}
Reply
Answers (
2
)
I am Getting an error in generating pdf
C# in App_Web_qy3z2pcs.dll but was not handled