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
Chriz L
NA
220
50.8k
Crystal report automatically send to clients default printer
Nov 14 2016 5:56 AM
Hello,
I need to be able to print a report automatically on client's local printer( some printers are on the same network and some others are usb-connected) .
I don't want to open the report in viewer before printing.
Here's my code:
protected
void
Print(
object
sender, EventArgs e)
{
ImageButton lnkRowSelection = (ImageButton)sender;
ReportDocument cryRpt =
new
ReportDocument();
string
[] commandArgs = lnkRowSelection.CommandArgument.ToString().Split(
new
char
[] {
','
});
string
idno = commandArgs[0];
string
company = commandArgs[1];
try
{
if
(lnkRowSelection.CommandArgument.ToString() ==
null
)
Response.Redirect(
"Default.aspx"
);
else
{
if
(company ==
"True"
)
cryRpt.Load(Server.MapPath(
"~/Reports/rep1.rpt"
));
else
cryRpt.Load(Server.MapPath(
"~/Reports/rep2.rpt"
));
if
(lnkRowSelection.CommandArgument.ToString() !=
null
)
{
cryRpt.SetParameterValue(
"@idno"
, idno);
cryRpt.SetParameterValue(
"Office"
, agr.getOffice());
cryRpt.PrintToPrinter(2,
true
, 1, 2);
}
}
}
catch
(Exception ex) { appObj.myMessageBox(ex.Message); }
}
Rep1 and rep2 were created using the report wizard.
Thank you in advance.
Reply
Answers (
6
)
Capture Screen @ 30fps
how to use Round method