activatePage

Loads and scrolls to the page by number.

To run the below example, open it in Dojo

Example

    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.2/pdf.js"></script>
    <script>
        window.pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.2/pdf.worker.js';
    </script>

    <div id="example">
        <div class="box">
            <div class="box-col">
                <h4>Change page</h4>
                <ul class="options">
                    <li>
                        <input id="numeric" type="number" title="numeric" value="17" min="1" max="3" step="1" style="width: 100%;" />
                    </li>
                </ul>
            </div>
        </div>
        <div id="pdfViewer">
        </div>
    </div>

    <script>
        $(document).ready(function () {
            var numeric = $("#numeric").kendoNumericTextBox({
                change: onChange,
                spin: onSpin,
                format: "n0",
                value: 1
            }).data("kendoNumericTextBox");

            var pdfViewer = $("#pdfViewer").kendoPDFViewer({
                pdfjsProcessing: {
                    file: "https://demos.telerik.com/kendo-ui/content/web/pdfViewer/sample.pdf"
                },
                width: "100%",
                height: 700
            }).data("kendoPDFViewer");


            function onChange(e) {
                var value = this.value();
                changePdfViewerPage(value)
            }

            function onSpin(e) {
                var value = this.value();
                changePdfViewerPage(value)
            }

            function changePdfViewerPage(value) {
                pdfViewer.activatePage(value);
            }
        });
    </script>
In this article
Not finding the help you need? Improve this article