Skip to Content
avatar image
Former Member

WPF Viewer Crashes When Printing in Print Dialog

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

capture.png (9.8 kB)
capture1.png (18.7 kB)
capture2.png (63.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Mar 07 at 10:11 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • May 24, 2017 at 10:31 PM

    Is your project 32 or 64 bit?

    Does that driver support either platform?

    Does it work if you print from CR Designer?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 30, 2017 at 03:06 PM

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

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • avatar image
    Former Member
    May 30, 2017 at 05:56 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 11, 2017 at 04:46 AM

    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?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 07 at 10:08 PM

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

    Add comment
    10|10000 characters needed characters exceeded