Getting the number of pages

2 posts, 0 answers
  1. Marta
    Marta avatar
    4 posts
    Member since:
    Mar 2015

    Posted 29 Jul 2015 Link to this post


    How to get the number of pages of the PdfViewer document?
    I am pasting (in case) a part of the code where I am importing the pdf document.


    public void ShowPdfFile(RadPdfViewer rad, string documentPath)
        _radPdfViewer = rad;
        _documentPath = documentPath;
            var readAllBytes = File.ReadAllBytes(documentPath);
            var memoryStream = new MemoryStream(readAllBytes);
            rad.DocumentSource = new PdfDocumentSource(memoryStream);
        catch (Exception e)

    Is it possible to get also the number of pages of the RadRichTextBox document?​



  2. Tanya
    Tanya avatar
    377 posts

    Posted 30 Jul 2015 Link to this post

    Hi Marta,

    After the document is imported you could get the count of the items in the RadFixedDocument's Pages collection:
    int pagesCount = this.pdfViewer.Document.Pages.Count;

    With RadDocument of RadRichTextBox you could take advantage of the NumPagesField, which will return as a result the total number of pages in the document. You could check the Fields article in our documentation for more details about the usage of these document elements.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top