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

Getting the number of pages

1 Answer 434 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Marta
Top achievements
Rank 1
Marta asked on 29 Jul 2015, 08:09 AM

Hi, 

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;
 
    try
    {
        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?​

BR,

Marta

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 30 Jul 2015, 10:22 AM
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 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.

Regards,
Tanya
Telerik
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
Tags
PDFViewer
Asked by
Marta
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or