Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
6
Reply
Crystal report automatically send to clients default printer
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Chriz L
7y
236
1
Reply
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.
Post
Reset
Cancel
Answers (
6
)
Next Recommended Forum
Capture Screen @ 30fps
how to use Round method