cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal SP 23 - WPF Viewer - Landscape

Former Member
0 Kudos

I'm not sure if this is the correct place to ask, But I will ask anyways:

I have patiently been waiting for SP 23 to be released to fix the "Landscape not printing from WPF Viewer" bug. SP 23 has finally been released and I see the issue on the list of fixes however it appears it's not actually fixed? Landscape definitely works now, however- I am trying to print a document from the viewer that is landscape / legal and the page prints in landscape (Rotated 90 degrees as it should) but the contents on the page are trimmed at what looks like 8.5in width. (And is centered). So it basically looks like someone printed a standard letter document and then taped it on top of a sideways piece of legal paper. What is the deal, is this another bug?

Also: If I print directly from the VS 2017 designer, the page print correct and is printed in landscape as the full page. When printing from the WPF viewer (No settings are changed from code and I am using the built in print dialog) I end up with what's described above.

I have checked printer settings and they are correct (Legal paper, landscape mode. These are auto set up when entering the report because of the size), I have tried every combination of disassociate (on/off) / no printer (on/off). Nothing gives me the intended result.

Thanks kindly.

EDIT: I just discovered that, by using the

"PrintToPrinter(printerSettings, pageSettings, reformat)" 

function, the landscape and page size work as expected and correctly. The printing bug I mentioned above exists when using the default print button / dialog. (Which is currently the button our customers use).

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Michael,

The WPF viewer by default uses the PrintToPrinter() which calls the generic Windows Framework to print the report, no option to alter the orientation. It's as is and no plans to ever change this basic functionality.

It's also a function you need to do with the Engine and RAS and the WinForm or WEB viewers, just get/set it.

If you set the Printers default orientation to landscape it will likely work but you need to use the RAS inProc server to do that as follows, that may override the default PrintToPrinter API:

public void button1_Click(object sender, RoutedEventArgs e)
{
    CrystalDecisions.CrystalReports.Engine.ReportDocument doc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
    CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc = doc.ReportClientDocument;
    doc.Load(@"C:\Reports\Samples\En\Reports\General Business\Sales With OnDemand Sub.rpt");
    rptClientDoc.PrintOutputController.ModifyPaperOrientation(CrPaperOrientationEnum.crPaperOrientationLandscape);

    crystalReportsViewer2.ViewerCore.ReportSource = rptClientDoc;
    crystalReportsViewer2.ViewerCore.Visibility = Visibility.Visible;
    crystalReportsViewer2.ShowPrintButton = true;
    crystalReportsViewer2.ToggleSidePanel = SAPBusinessObjects.WPF.Viewer.Constants.SidePanelKind.GroupTree;
    crystalReportsViewer2.ViewerCore.EnablePrint = true;
    //crystalReportsViewer2.ViewerCore.PrintReport();
    //doc.PrintToPrinter(1, false, 1, 1);
    //doc.Close();

}

Now create your own print button and use the PrintOutputController to do the printing.

The WPF viewer is still in it's early years and does need more enhancements, not many people use it so they don't enhance it by default.

Thanks again

Don

Answers (8)

Answers (8)

Former Member
0 Kudos

Really shouldn't ship PDB files or ship the .dll's in debug mode. But, since you do, I was able to fix this landscape printing issue for most cases.

I think it could be fixed in the Crystal WPF runtime by removing the line with the red box around it. (edit: if someone needs the fix for their application, contact me privatly.)

Feel free to delete this post if you don't want your code posted. But, this should give you an idea as to why people are experiencing issues.

Cheers!

Former Member
0 Kudos

I'm going to post some observations.

  • SP 23 has a variation of the same landscape printing error.
  • It's not related to any specific version of Windows. I have found that earlier versions of this error (previous SPs) were influenced by specific Windows security and quality updates and that removing specific updates resolved the issue. It's possible that updates are still influencing the printing in SP 23, but I can not confirm that.
  • This error in SP 23 happens regardless of it being bound to a printer or not.
  • Print to XPS works fine.

It's always printing to the portrait orientation, regardless of what is set in the print dialog or anywhere else. It's otherwise printing the landscape document properly in portrait orientation. It's just clipping the content at the bounds.

This should be a really simple fix. The software is wiping out the orientation from the print dialog print ticket, and setting it to portrait, after accepting user input, and before sending it on to print. It shouldn't do that.

0 Kudos

I tested it using 1803 build and it works fine also so it must be the printer you are using that is scaling the page.

Don

0 Kudos

Ah, that's the problem. We have not tested using build 1803 since it was jsut released.

I have the same problem, it does not recognize any of my local Printers when used in VM-Ware.

Same problem we had in 1709 build using Remote Connector.

I'll ask R&D to test and hopefully we can get Windows 10 1803 supported in SP 24.

Your report and app work kfine on Windows 1709.

Thanks again

Don

Former Member
0 Kudos

Also: Attached are images of the issue. The working image was printed directly from Visual Studio 2017 Report Designer. The non-working version was printed from the WPF Viewer.

All of my Reference versions show:

Runtime Version: 2.0.50727

Version: 13.0.3500.0

These were updated after installing SP23.

(VS17 - Preview Panel - Print Button) Working:

(WPF Viewer, Default print button) Not Working

Former Member
0 Kudos

Sorry for the late reply, I've Been busy lately.

winver says "Windows 10, Version 1803 (OS Build 17134.228).

My customer has some windows 7 machines and some windows 10 machines. The problem doesn't exist in the windows 7 machines, only those that are windows 10 (Which are kept up to date with updates.).

I will be doing an install on all of their workstations next week, I will write a reply with the results if this does / doesn't work on which machines with which versions of OS and so on. As of right now, the 2 machines that have been tested are a windows 7 machine (Unsure of version, Works) and the mentioned windows 10 machine. (Default print button on landscape doesn't work)

Thank you for your time.

0 Kudos

mmmm, I finally got my windows image running again and tried it and I don't see the problem....

If you type winver from the search line inf Windows what version does it say?

All we tested with was 1709, nothing newer...

Don

0 Kudos

Hi Eddy,

Printing from the Designer in VS uses an ActiveX printer component and not the WPF viewer.

I pinged the Developer who fixed it and we'll see if she responds tomorrow her time. When I get in tomorrow my time I'll test it also.

What printer are you using?

Thanks again

Don

Former Member
0 Kudos

Thanks for replying Don, I've tested with these laser printers:

Brother DCP-L2540DW

Brother MFC-L2700DW

I've also tried using the "Send To OneNote 2016" feature that comes with OneNote, this ends up outputting a portrait document with the right half of the document missing.

I'm not doing anything fancy with the document, just a simple .Load when loading up the report viewer.

I'm using the latest version of windows 10 (all up to date) as of today (8/15/2018).

For now I have added a button that floats on top of the "WPF Report Viewer" that says "Print", this simply calls PrintToPrinter and works for the moment but makes things a bit more confusing for the end user to have to use a separate button to print landscape / landscaped legal documents. (As they prefer the default print button where they have the ability to choose printers, page count, and so on).