I am using Telerik reporting in a VB.net app. The reports each preview correctly, but if I print directly to a printer, it comes up blank. To PDF it saves a blank file. To a physical printer, it goes through the motions with the driver, but nothing is actually printed.
Telerik.Reporting.dll is version 15.0.21.326.
What am I missing?
code below:
Public Sub SaveReport(ByVal myreport As Telerik.Reporting.Report, filename As String)
Dim reportProcessor As Telerik.Reporting.Processing.ReportProcessor = New Telerik.Reporting.Processing.ReportProcessor()
Dim instanceReportSource As Telerik.Reporting.InstanceReportSource = New Telerik.Reporting.InstanceReportSource()
instanceReportSource.ReportDocument = myreport
Dim renderingResult As Telerik.Reporting.Processing.RenderingResult = reportProcessor.RenderReport("PDF", instanceReportSource, Nothing)
Dim fs As FileStream = New FileStream(filename, FileMode.Create)
fs.Write(renderingResult.DocumentBytes, 0, renderingResult.DocumentBytes.Length)
fs.Close()
End Sub
Public Sub PrintReport(ByVal myreport As Telerik.Reporting.Report, ByVal Copies As Integer)
strModErr = "Module1_PrintReport"
Dim printerSettings As PrinterSettings = New PrinterSettings()
Dim printController As PrintController = New StandardPrintController()
Dim reportProcessor As ReportProcessor = New ReportProcessor()
Dim instanceReportSource As Telerik.Reporting.InstanceReportSource = New Telerik.Reporting.InstanceReportSource()
Try
instanceReportSource.ReportDocument = myreport
printerSettings.PrinterName = My.Settings.DriverLogPrinter
printerSettings.Copies = Copies
reportProcessor.PrintController = printController
reportProcessor.PrintReport(instanceReportSource, printerSettings)
Catch ex As Exception
WriteErrorToLog(Err.Number, strModErr + " - " + Err.Description)
Dim inner As Exception = ex.InnerException
Do
If inner IsNot Nothing Then
WriteErrorToLog(666, inner.GetType().Name + ": " + inner.Message)
inner = inner.InnerException
End If
Loop While inner IsNot Nothing
End Try
End Sub