SAP Knowledge Base Article - Public

1678989 - When clicked on Print button of CrystalReportViewer shows Print to Pdf dialog box instead of ActiveX using custom .NET web application.

Symptom

  • PrintMode of CrystalReportViewer is set to ActiveX.
  • When clicked on Print button of CrystalReportViewer shows Print to Pdf dialog box instead of ActiveX using custom .NET web application.

Environment

  • Crystal Reports 2008
  • Crystal Reports for Visual Studio 2010
  • Visual Studio 2008

Reproducing the Issue

  1. Set the PrintMode to ActiveX for CrystalReportViewer  on aspx page.

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" PrintMode="ActiveX" />
  1. Set the PrintMode to Pdf for CrystalReportViewer in code behind like following:  
ReportDocument rd = new ReportDocument();
rd.Load(Server.MapPath("CrystalReports1.rpt"));
CrystalReportViewer1.ReportSource = rd;
CrystalReportViewer1.PrintMode = PrintMode.Pdf;
  1. Run the application.

Cause

PrintMode in the code when set to Pdf overrides the ActiveX PrintMode set in the properties of CrystalReportViewer.

Resolution

Depending upon the mode required following are the resolutions:

  • For ActiveX PrintMode:
    1. Set the PrintMode property of CrystalReportViewer to ActiveX like following

     <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" PrintMode="ActiveX" />

    1. Use the following code

CrystalReportViewer1.PrintMode = PrintMode.ActiveX;
  • By default it uses Print to Pdf Mode so there is no need to mention it explicitly.

Keywords

CRVS2010 CR4VS2010 2010 crvs net sdk cr4vs , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports, developer version for Microsoft Visual Studio