65.9K
CodeProject is changing. Read more.
Home

Crystal Reports To PDF converter Without Crystal Report Viewer

starIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIconemptyStarIcon

1.43/5 (8 votes)

Jun 23, 2006

viewsIcon

113444

downloadIcon

2705

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