C# .NET - Printing Crystal Report on Client Side
Asked By Rajiv Gogia on 30-Jun-12 12:02 PM
Hi,,
In my case when i am using Crystal Report, In order to print crystal report, I have to export it to pdf first and then print it.
However, I am looking for a solution to print the crystal report directly on Client side (not on server side )..
Thanks in advance..
Rajiv
Lalit M replied to Rajiv Gogia on 30-Jun-12 03:16 PM
Include CrystalDecisions.CrystalReports.Engine in your C# Source Code.
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
Copy and paste the following source code and run your C# project
using System;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
ReportDocument cryRpt;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
cryRpt = new ReportDocument();
cryRpt.Load(PUT CRYSTAL REPORT PATH HERE\\CrystalReport1.rpt");
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
}
private void button2_Click(object sender, EventArgs e)
{
try
{
ExportOptions CrExportOptions ;
DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
CrDiskFileDestinationOptions.DiskFileName = "c:\\csharp.net-informations.pdf";
CrExportOptions = cryRpt.ExportOptions;
{
CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
CrExportOptions.FormatOptions = CrFormatTypeOptions;
}
cryRpt.Export();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}
Lalit M replied to Rajiv Gogia on 30-Jun-12 03:24 PM
export CR to PDF on client side & print is show good article and info u will get here
------
http://csharp.net-informations.com/crystal-reports/csharp-crystal-merge-module.htm
http://www.dotnetspider.com/resources/43685-How-export-crystal-report-PDF-through-C.aspx
http://www.dotnetspider.com/resources/35496-How-To-Export-Crystal-Report-PDF-ASP-Net.aspx