title: Crystal Reports prints portrait orientation instead of landscape
body: <p>I created a very simple test report (.rpt file) in SAP Crystal Reports 14.1.4.1327. I set page orientation to landscape in Page Setup. If I print my document from Crystal Reports Designer it is printed properly in landscape. 
  I require to print report from C# application. I uses SAP Crystal Reposrts runtime engine for .Net 13.0.6.1027</p>
  
  <pre><code>ReportDocument rp = new ReportDocument();
  rp.Load(path_to_my_report_file);
  rp.PrintOptions.PrinterName = printerName;
  rp.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
  rp.PrintToPrinter(0, false, 0, 2);
  </code></pre>
  
  <p>It prints always in portrait orientation. I don't know why it does not work. </p>
  
  <p>I also tried <code>PrintToPrinter(PrinterSettings printerSettings, PageSettings pageSettings, bool reformatReportPageSettings)</code> method and I set </p>
  
  <pre><code>...
  System.Drawing.Printing.PrinterSettings printersettings = new   System.Drawing.Printing.PrinterSettings();
  printersettings.DefaultPageSettings.Landscape = true
  ...
  rp.PrintToPrinter(printersettings, pageSettings, false);
  </code></pre>
  
  <p>but it also does not work.</p>
  
  <p>How to print report in landscape? I can't modify printer driver configuration so solution must be based on C# or .rpt file. </p>
  
  <p><strong>===EDIT===</strong></p>
  
  <p>I tested my case also on another printer (RICOCH) and it prints properly in landscape. I uses ZEBRA ZTC S4M-200dpi ZPL and it prints portait instead of landscape. So maybe Zebra driver is not full compatible with .Net.</p>
  
  <p><strong>===EDIT===</strong></p>
  
  <p>I noticed that Zebra prints report properly if PaperSize is set properly. So following code works:</p>
  
  <pre><code>...
  System.Drawing.Printing.PrinterSettings printersettings = new   System.Drawing.Printing.PrinterSettings();
  printersettings.DefaultPageSettings.Landscape = true
  System.Drawing.Printing.PageSettings pageSettings = new System.Drawing.Printing.PageSettings();
  ...
  pageSettings.PaperSize = new System.Drawing.Printing.PaperSize("name", 400, 600);
  rp.PrintToPrinter(printersettings, pageSettings, false);
  </code></pre>
  
  <p>Where 400 is width, 600 is high in portrait orientation in hundredths of an inch. So C# application needs to retrieve page width, page high and page orientation from report. I don't know how to retrieve these parameters. I ask about it <a href="https://stackoverflow.com/questions/29848804/how-to-retrieve-crystal-page-setting-programmatically-in-c">here</a></p>