This is a migrated thread and some comments may be shown as answers.

RenderReport pdf pagecount

1 Answer 112 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
John asked on 17 Jan 2014, 05:38 PM

In the sample code below is there a way to tell how many pages exported the pdf has?

Public Sub CreateProcessNotesPDF()
    Dim instanceReportSource As New Telerik.Reporting.InstanceReportSource()
    instanceReportSource.ReportDocument = New ProcessNotes
    instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("ProcNo", _procNo))
    instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("ApplicantName", _applicantName))
    Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor()
    'set any deviceInfo settings if necessary
    Dim deviceInfo As New System.Collections.Hashtable()
    Dim result As Telerik.Reporting.Processing.RenderingResult = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo)
    Dim fileName As String = result.DocumentName + "." + result.Extension
    'Dim path As String = System.IO.Path.GetTempPath()
    Dim path As String = System.IO.Directory.GetCurrentDirectory()
    Dim filePath As String = System.IO.Path.Combine(path, fileName)
    Using fs As New System.IO.FileStream(filePath, System.IO.FileMode.Create)
        fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length)
    End Using
End Sub

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 22 Jan 2014, 12:33 PM
Hello John,

The exported PDF's page count cannot be obtained from the report processor directly. Thus, in order to get the page count in your code you can use a third party PDF library. Some possible solutions are described here.


New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

General Discussions
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question