.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

how to export crystal report in pdf file by default using C#

Posted By: Naim Khan     Posted Date: May 20, 2010    Points:2   Category :C#
hi friends,

we are using the crystal reports that comes with Visual studio 2005 for developing a c# windows application. we need to make the pdf the default export format for report. can anyone tell me how this can be done.

Naim Khan

Author: Lalij Mer             
Posted Date: May 20, 2010     Points: 5   

you can try this code sample

using System;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace WindowsApplication1
public partial class Form1 : Form
ReportDocument cryRpt;

public Form1()

private void button1_Click(object sender, EventArgs e)
cryRpt = new ReportDocument();
cryRpt.Load(PUT CRYSTAL REPORT PATH HERE\\CrystalReport1.rpt");
crystalReportViewer1.ReportSource = cryRpt;

private void button2_Click(object sender, EventArgs e)
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;
catch (Exception ex)


For Reference

Please Check my answer if you help....
Thank You...

Author: BangaruBabuPureti             
Posted Date: May 22, 2010     Points: 5   

Hi Khan ,There is no need to Write manual coding to export PDF Document if u Place Crystal Report Viewer

it will automatically Populate PDF WIth Left Side icons

BangaruBabu Pureti
Author: arronlee             
Posted Date: October 17, 2015     Points: 20   

Hi Khan,
I wonder how can I deal with those codes? Do I need another pdf conversion sdk like this one?

Next Tomorrow is Another Day .

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend