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);
//Gets the total page count. 
int pageCount = pdfViewer.PageCount;
Dim loadedDocument As New PdfLoadedDocument(Buffer)
'Gets the total page count. 
Dim pageCount As Integer = pdfViewer.PageCount