cancel
Showing results for 
Search instead for 
Did you mean: 

WPF Viewer Crashes When Printing in Print Dialog

Former Member
0 Kudos

Hello,

When printing report via the print dialog that the WPF viewer displays after clicking the print button on the tool bar (see image 1 below), the viewer crashes after clicking the print button (see image 2 below) on the print dialog.

The third image below depicts the error message in Visual Studio 2013.

I have version 13.0.20.2399 of SAP Crystal Reports for Visual Studio.

Here is the code association:

private ReportViewer() //make its constructor private 
{ 
     InitializeComponent(); 
     //set the crystal report viewer owner property to the this containing window 
    //(prevents errors when referencing formula fields in the report)      
      crystalReportsViewer1.Owner = Window.GetWindow(this); 
     //Initially hide tool panel view 
     this.crystalReportsViewer1.ToggleSidePanel = Constants.SidePanelKind.None; 


 private void DeptBatchIdCards_Report()
   {
            //variables to store report path
            string exeFolder = System.Windows.Forms.Application.StartupPath;
            string reportPath = System.IO.Path.Combine(exeFolder, @"ReportViews\DeptBatch_IdCards.rpt");


            //create report document objects and set datasources for reports
            ReportDocument deptBatchIdCardsReport = new ReportDocument();
            deptBatchIdCardsReport.Load(reportPath);




            deptBatchIdCardsReport.SetDataSource(_employeeBO.GetEmployeeIdCard_List(Client.gblClientID, _deptList));
        
            //set the report source for the crystal report viewer
            deptBatchIdCardsReport.Refresh();
            this.crystalReportsViewer1.ViewerCore.ReportSource = deptBatchIdCardsReport;
            
}

Image 1.

Image 2.

Image 3.

Many thanks!

R

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

There have been updates to the WPF viewer in SP 22. One known issue is printing landscape on Windows 10 version 1709 and Windows 7 SP1.

It's been escalated and should have a fix in SP 23.

Can you guys test using SP 22 from here:

https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

And PLEASE read the info for SP 21, must do the same for SP 22.

If you can then I'll confirm and get the fix in SP 23 if we can.

Don

Answers (5)

Answers (5)

Former Member
0 Kudos

I'm having this same issue, have you found a solution?

Former Member
0 Kudos

I write from Bogota - Colombia and I have the same problem, press the print button and the crystal report generates an error, it must restart the application again. Why is this happening?

Former Member
0 Kudos

Hi Don,

I'm printing to paper.

I also tried "Print to PDF" (not to an address book), which is also producing the same error as specified earlier.

Please see original post images of the exact results when printing from the WPF viewer.

I don't have a print routine (hence I cannot put a try/catch block), because the print function is executed via the WPF viewer toolbar print button.

Anyhow, the crash occurs on the print dialog itself after selecting printer and then clicking print.

Thanks many.

R.

Former Member
0 Kudos

- Rudy - 2 days ago

Hi Don,

Thanks for your input thus far.

However, when I've tried both x86 or x64 and updated the printer driver, I still get the same error result.

Also having the same error result with print to PDF option in the print dialog.

I've also went as far as uninstalling the SAP Crystal Reports for Visual Studio and then just installed the 32 bit runtime with the x86 for the project, and still also got the same error result.

Any other possibilities?

Thanks again.

R.

0 Kudos

Hi Rudy,

Are you printing to Fax or to paper?

I installed the driver and I don't get an error or crash but it does not work due to permissions or when using Office 2016 because there are no people in the address book. And in 64 bit mode you need the 64 bit version of Office installed to be able to print to an address book.

If you print from the Viewer's print button what happens?

Put your print routine in a Try/Catch block and see what the exception is.Or use DebugDiag to see what dll it's crashing in.

Don

0 Kudos

Is your project 32 or 64 bit?

Does that driver support either platform?

Does it work if you print from CR Designer?

Former Member
0 Kudos

Hi Don,

The project is for both 32 and 64 bit (any CPU).

Not sure if the driver does support both 32 and 64 bit.

How can I find out?

Yes the print function works in the CR designer and it prints to my default printer.

Thank you,

R.

0 Kudos

OK, CR is runtime is for your app platform and not the OS. So set to x86 or x64, try not to use AnyCPU.

Search the Printers web site for updated drivers, usually it will say or an option for either platform.

CRD is 32 bit only.

Former Member
0 Kudos

Hi Don,

Thanks for your input thus far.

However, when I've tried both x86 or x64 and updated the printer driver, I still get the same error result.

I've also went as far as uninstalling the SAP Crystal Reports for Visual Studio and then just installed the 32 bit runtime with the x86 for the project, and still also got the same error result.

Any other possibilities?

Thanks again.

R.

Former Member
0 Kudos

Also having the same error result with print to PDF option in the print dialog.

Thanks.

R.