Click here to Skip to main content
16,022,971 members
Articles / Programming Languages / SQL
Article

Crystal Reports To PDF converter Without Crystal Report Viewer

Rate me:
Please Sign up or sign in to vote.
1.08/5 (12 votes)
22 Jun 2006 113.4K   2.7K   35   15
Here You Can Convert Crystal Report To PDF

Introduction

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared

Public Class clsCrystalToPDFConverter

Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo

Dim oRDoc As New ReportDocument

Dim expo As New ExportOptions

Dim sRecSelFormula As String

Dim oDfDopt As New DiskFileDestinationOptions

Dim strCrystalReportFilePath As String

Dim strPdfFileDestinationPath As String

Public Function SetCrystalReportFilePath(ByVal CrystalReportFileNameFullPath As String)

strCrystalReportFilePath = CrystalReportFileNameFullPath

End Function

Public Function SetPdfDestinationFilePath(ByVal pdfFileNameFullPath As String)

strPdfFileDestinationPath = pdfFileNameFullPath

End Function

Public Function SetRecordSelectionFormula(ByVal recSelFormula As String)

sRecSelFormula = recSelFormula

End Function

Public Function Transfer()

oRDoc.Load(strCrystalReportFilePath) 'loads the crystalreports in to the memory

oRDoc.RecordSelectionFormula = sRecSelFormula 'used if u want pass the query to u r crystal form

oDfDopt.DiskFileName = strPdfFileDestinationPath 'path of file where u want to locate ur PDF

expo = oRDoc.ExportOptions

expo.ExportDestinationType = ExportDestinationType.DiskFile

expo.ExportFormatType = ExportFormatType.PortableDocFormat

expo.DestinationOptions = oDfDopt

oRDoc.SetDatabaseLogon("PaySquare", "paysquare") 'login for your DataBase

oRDoc.Export()

End Function

End Class

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect Smart wireless pvt ltd. Pune
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.