Articles in this section
Category / Section

How to get the current page number which is being displayed in the PdfViewer

1 min read

PDF Viewer

The ASP.NET MVC PDF Viewer control supports viewing, reviewing, and printing PDF files in ASP.NET MVC applications. The hyperlink and table of contents support provides easy navigation within and outside the PDF files. The form-filling support provides a platform to fill, flatten, save, and print PDF files with AcroForm. PDF files can be reviewed with text markup annotation tools.

Getting the current page number

You can access the number of the page being displayed in PDF viewer using the client side currentPageNumber API on button click. The PageChanged event triggers when there is a change in the current page number. Refer to the following code.

HTML

<div>
    <button onclick="getPageNumber(event)" type="button">Get Current Page Number</button>
    <div style="width:100%;height:950px;">
        @(Html.EJ().PdfViewer("pdfviewer").ServiceUrl("../../api/PdfViewer").ClientSideEvents(e => e.PageChanged("onPageChange")))
    </div>
</div>

JavaScript

function getPageNumber(event) {
        var obj = $("#pdfviewer").data("ejPdfViewer");
        alert("Current Page number is"+obj.currentPageNumber);
    }
    function onPageChange(args) {
        alert("Current page is changed");
    }

Sample:

https://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewer_CurrentPageNumber-640539629

Refer here to explore the rich set of PDF Viewer features. 

An online demo link to view PDF documents using Syncfusion PDF Viewer.

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied