title: How to print Crystal report with Javascript?
body: <p>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:</p>
  
  <pre><code>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);
  
  
  
      }
  </code></pre>
  
  <p>this code allows to print from a print dialog box but when I deploy this system to the server which is :    <strong>Windows Server 2008 R2 Enterprise</strong></p>
  
  <p>I get an error message that </p>
  
  <p><code>The ShowDialog is not applicable with server</code></p>
  
  <p>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:    <code>window.print();</code></p>
  
  <p>Your help will be most appreciable.
  I would like to mention: My system is a Web Application, Using ASP.Net, C#</p>