Posted 23 May 2018, 2:25 am EST
Hello,
You simply use the following line of code to export into PDF file:
Dim pr As New PageReport()
Try
setReportMarkup(pr, "pt", "portrait")
pr.Report.DataSources.Add(myDataSource())
pr.Report.DataSets.Add(myDataSet())
pr.Document.Printer.PrinterName = String.Empty
pr.Run()
' Create an output directory.
Dim outputDirectory As New System.IO.DirectoryInfo("C:\MyPDF")
outputDirectory.Create()
' Provide settings for your rendering output.
Dim pdfSetting As New GrapeCity.ActiveReports.Export.Pdf.Page.Settings()
' Reduce the report size and report generation time.
pdfSetting.OptimizeStatic = True
' Set the rendering extension and render the report.
Dim pdfRenderingExtension As New GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension()
Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name))
' Overwrite output file if it already exists
outputProvider.OverwriteOutputFile = True
pr.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting)
Catch ex As Exception
Dim x As String = ""
End Try
Note:- I have referred modified the code that is given by you in the previous post.
Also, please add the “GrapeCity.ActiveReports.Export.Pdf.v12.dll” reference in your project.
Hope it helps.
Thanks,
Mohit