I have a Crystal Report developed on Crystal report 13 but the server where I have to deploy it has Crystal Report 10. My client want to print the crystal report direct to their printer. They dont want any PDF but now it is exporting as PDF fine. Then with the help of Stackoverflow friend I wrote the below code and now its asking for print. My code is as below:
CrystalDecisions.CrystalReports.Engine.ReportClass clsReport = new CrystalDecisions.CrystalReports.Engine.ReportClass();
protected void Button3_Click(object sender, EventArgs e)
{
System.Windows.Forms.PrintDialog dialog1 = new System.Windows.Forms.PrintDialog();
dialog1.AllowSomePages = true;
dialog1.AllowPrintToFile = false;
dialog1.ShowDialog();
if (dialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
int copies = dialog1.PrinterSettings.Copies;
int fromPage = dialog1.PrinterSettings.FromPage;
int toPage = dialog1.PrinterSettings.ToPage;
bool collate = dialog1.PrinterSettings.Collate;
clsReport.PrintOptions.PrinterName = dialog1.PrinterSettings.PrinterName;
clsReport.PrintToPrinter(copies, collate, fromPage, toPage);
}
this code allows to print from a print dialog box but when I deploy this system to the server which is : Windows Server 2008 R2 Enterprise
I get an error message that
The ShowDialog is not applicable with server
So, now I want a Javascript code which can allow to print the page from Client side also. But I dont know how to do it. And how I can hide the button on the page from Javascript Printing: window.print();
Your help will be most appreciable. I would like to mention: My system is a Web Application, Using ASP.Net, C#