Skip to Content
avatar image
Former Member

Crystal Reports WPF Viewer Prints in Portrait even with Landscape reports

I am using the SAP Crystal Reports runtime engine for .NET Framework v13.0.22.2668 on Windows 10 Pro Version 1709 (OS Build 16299.192). When trying to print a landscape report from the WPF Viewer (using the print button built into the user control) it always prints in portrait mode, even on landscape reports and even when overriding the it to print in landscape at the print driver level. I had read this was fixed in v13.0.17 of the runtime engine, but it doesn't seem to be the case. All of the reports are set to No Printer in the printer options. I've tried setting a printer and it doesn't seem to work either. Has anyone experienced this issue and is there a work around?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

12 Answers

  • Best Answer
    Feb 23 at 10:19 PM

    See this post:

    https://answers.sap.com/answers/439601/view.html

    Same as this one.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 25 at 06:10 PM

    Hi Alexander,

    I just tested this and it works for me.

    What printer are you selecting from the viewer?

    Don

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 26 at 08:48 PM

    We have about 15 different printers in our office and this is the case for every printer. We are not using the XPS Document Writer.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 15 at 07:38 AM

    I am using a physical printer. We have about 15 different printers in our office and all of them are doing this. I am not using the XPS Document Writer.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 30 at 07:01 PM

    Hi Alexander,

    I can dup the issue only when in the report if Dissociate is unchecked and no printer is selected.

    Adding this did not fix the problem:

    reportDocument.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true;

    Only work around is to open each report and check that option on.

    It's likely by design, you specified it to use no printer so it uses usp10.dll to generate the page and when not using Dissociate it defaults to portrait.

    I'll ask DEV if they can change the behaviour and possibly get it into SP 23. For now change your reports

    Don

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I have the exact same issue with no solution regardless of if I select Dissociate yes or no.

      I have temporarily "fixed" the issue by de-installing versions .20 and .22 and replacing them with version .14.

  • avatar image
    Former Member
    Feb 02 at 12:16 AM

    Version of Windows used - Windows 10 Pro Version 1709 (OS Build 16299.192) winver.png

    Printers Installed - The main printers that are in use are HP Laserjet P41014n, Dell S2830dn, Brother HL-L5200DW, and HO LaserJet 600 M601 if it worked with these at the very least I could live, but we have a dozen other printers that will likely use this application as well.

    Assemblies - assemblies.png

    Test app - Yes. I have an application in production that is having this issue and I have a simple application having this problem as well. The module list I included is from my simple application.

    Admin Rights - I've tried running with and without, no change.

    My example app is very simple:

    // MainWindow.xaml.cs
    
    namespace WpfApp1
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
    
    
                ReportDocument report = new ReportDocument();
                report.Load(filename: "\\\\FS1\\CompanyWide\\Crystal Reports\\NexusSummary.rpt");
                viewer.ViewerCore.ReportSource = report;
                report.Refresh();
            }
        }
    }
    
    // MainWindow.xaml
    
    <Window x:Class="WpfApp1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:v="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer"
            mc:Ignorable="d"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <v:CrystalReportsViewer x:Name="viewer"></v:CrystalReportsViewer>
        </Grid>
    </Window>
    
    
    
    Add comment
    10|10000 characters needed characters exceeded

  • Feb 02 at 03:56 PM

    Here's my code, made no difference if I set it in code either. But as noted if Dissociate is checked on it works for me on Windows 10 1703:

    private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
    {
    var reportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
    var reportPath = @"D:\Reports\LandscapeWPF.rpt";

    reportDocument.Load(reportPath, CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy);
    //reportDocument.SetParameterValue("End Account Number", "1");
    reportDocument.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true;
    reportDocument.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
    reportDocument.Refresh();

    this.MainReportViewer.ViewerCore.ReportSource = reportDocument;
    }

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member
      namespace WpfApp1
      {
          /// <summary>
          /// Interaction logic for MainWindow.xaml
          /// </summary>
          public partial class MainWindow : Window
          {
              public MainWindow()
              {
                  InitializeComponent();
      
      
                  ReportDocument report = new ReportDocument();
                  report.Load(filename: "\\\\FS1\\CompanyWide\\Crystal Reports\\NexusSummary.rpt");
                  report.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true;
                  report.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
                  viewer.ViewerCore.ReportSource = report;
                  report.Refresh();
              }
          }
      }
      

      This doesn't work. You note this is working for you on Windows 10 1703, but as I have noted previously we are on 1709.

      Here you can see both No Printer and Dissociate is checked:

      pagesetup.png (15.7 kB)
  • Feb 05 at 10:46 PM

    I doubt it's the 1709 build but I'm updating a test image now and will try again.

    If it fails then likely something MS changed that we are not aware of and I'll have to get R&D to add 1709 to the supported platform.

    Don

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 01 at 05:04 PM

    OK, I still can't duplicate the issue so I need specific details:

    Version of Windows used?

    Printers installed?

    Modules list of dll's/assemblies used?

    Have you tried a simple test app?

    Run with Admin Rights?

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 08 at 03:16 PM

    I wonder if this has anything to do with this issue:

    https://www.tenforums.com/performance-maintenance/96792-fall-creators-update-poor-performance-lagginess-fix.html

    R&D is fixing CR Designer and said it will affect CR for VS as well.... Since it's all Viewer based it may have some other side effect.

    Still trying to get 1709 image working

    Don

    Add comment
    10|10000 characters needed characters exceeded