Skip to Content
0

Crystal Reports WPF Viewer Prints in Portrait even with Landscape reports

Jan 25 at 04:30 PM

311

avatar image
Former Member

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

12 Answers

Best Answer
Don Williams
Feb 23 at 10:19 PM
0

See this post:

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

Same as this one.

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Jan 25 at 06:10 PM
0

Hi Alexander,

I just tested this and it works for me.

What printer are you selecting from the viewer?

Don

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 26 at 08:48 PM
0

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.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

When you print from the Viewer and select Landscape does that work?

landscape.jpg (84.5 kB)
0
Former Member

Negative. This still prints the report as portrait.

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

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.

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Jan 30 at 07:01 PM
0

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

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

All the reports are set to Dissociate and No Printer and still getting this issue.

0
Former Member

I should also note that this only affects printing from the WPF Viewer. When running the preview for these reports in the designer and printing from Crystal Reports 2016, it prints as expected.

0
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.

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

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>



assemblies.png (9.6 kB)
winver.png (14.5 kB)
Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Feb 02 at 03:56 PM
0

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;
}

Show 1 Share
10 |10000 characters needed characters left 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)
0
Don Williams
Feb 05 at 10:46 PM
0

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

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Any update here?

0

Not easy getting 1709. I've asked our VM IT people to see if they can update one of the images for me.

Not sure how long it's going to take....

Don

0
Former Member

Ok thank you. Keep me updated.

0

I got one,

Installing VS 2017 now and will test tomorrow

0
Don Williams
Feb 01 at 05:04 PM
0

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?

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Feb 08 at 03:16 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded