Search results

Capture the current page number being viewed in ASP.NET Core PDF Viewer control

20 Jan 2022 / 1 minute to read

The PDF Viewer server library allows you to capture the page number that is currently being viewed in the load PDF document. Use the currentPageNumber property to get the page number which is currently in view.

The following steps are used to capture the current page number.

Step 1: Follow the steps provided in the link to create a simple PDF Viewer sample.

Step 2: Use the following code snippet to Capture the current page number being viewed.

Copied to clipboard
<button onclick="currentPage()">currentpage</button>

<script>

    function currentPage() {
        var viewer = document.getElementById('pdfviewer').ej2_instances[0];
        var pageNumber = viewer.currentPageNumber;
        alert("current page number is" + pageNumber);
    }

</script>

Download the sample how to capture the current page number being viewed