Exporting from Crystal Reports to PDF format , we are using Crystal Reportss CrExportOptions . Also we have to set PdfRtfWordFormatOptions and ExportFormatType.PortableDocFormat . In the following example you can see how to export a Crystal Reports as a PDF format file.
All Crystal Reports programming samples in this tutorials is based on the following database (crystaldb) . Please take a look at the database structure before you start this tutorial - Click here to see Database Structure .
In this tutorial we are using our earlier program step by step Crystal Report for pull data from database to Crystal Reports . Before we start this section take a look at the step by step Crystal Report in VB.NET .
In the step by step Crystal Report we pull all data from Product table , here now we are exporting that data to a PDF format file.
Select the default form (Form1.vb) you created in VB.NET and drag two buttons (Button1, Button2 ) and CrystalReportViewer control to your form.
Select Form's source code view and import the following :
Imports CrystalDecisions.CrystalReports.Engine
Put the following source code in the button click events
VB.NET Source Code
NOTES:
cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")
The Crystal Report is in your project location, there you can see CrystalReport1.rpt . So give the full path name of report here.
When you run this program you will get the PDF file (crystalExport.pdf) in your computer's C:\