Acquire number of pages in the document being displayed

8 Jun 20211 minute to read

Using PDF Viewer the user can acquire number of pages in the document being displayed. The following code can be used to access the total number of pages displayed in the PDF Viewer. Here ‘buffer’ is the byte array read from the PDF file either using FileOpenPicker or from Assets folder, as illustrated in the Viewing PDF section.

PdfLoadedDocument loadedDocument = new PdfLoadedDocument(buffer);
pdfViewer.LoadDocument(loadedDocument);
//Gets the total page count. 
int pageCount = pdfViewer.PageCount;
Dim loadedDocument As New PdfLoadedDocument(Buffer)
pdfViewer.LoadDocument(loadedDocument)
'Gets the total page count. 
Dim pageCount As Integer = pdfViewer.PageCount