Last Updated: 03 Sep 2021 13:29 by ADMIN
Created on: 27 Aug 2021 15:01
Category: PDFViewer
Type: Bug Report
Open event not fired on PDFViewer component

I load a pdf on a PDFViewer component using loadDefault function, but Open event is not fired.

Also, I want to scroll to the end of the document and for that, I need to retrieve the count of the pages and activate the last page in the render event, even it's called multiple times.

How can I get the count of the pages and scroll to the end of the .pdf document after it is loaded?

        .PdfjsProcessing(pdf => pdf.File(Url.Content("~/Content/data/default.pdf")))
        .Events(e => e
            .Error("(function(e) { onDocumentViewerError(e); })")
            .Render("(function(e) { onDocumentViewerRender(e); })")
            .Open("(function(e) { onDocumentViewerOpen(e); })")
<script type="text/javascript">

function loadDefault() {
    var docUrl = window.location.origin + window.location.pathname + "Content/data/default.pdf";

    var pdfViewer = $("#documentViewer").data("kendoPDFViewer");

onDocumentViewerRender = function(e) {

    if (goToEnd) {
         goToEnd = false;

         setTimeout(function () {
              var pdfViewer = $("#documentViewer").data("kendoPDFViewer");
              pdfViewer.activatePage(pagesCount); // how to get pagesCount
         }, 2000);

onDocumentViewerOpen = function(e) {
    console.log("open"); // not shown in Console
1 comment
Ivan Danchev
Posted on: 03 Sep 2021 13:29

Hello Mugurel,

The Open event fires only when the user opens a .pdf file from the Open tool in the PDFViewer's toolbar.

As for the pages count, you can get it and scroll to the last page as shown below:

var pagesCount = pdfViewer.pages.length;

Ivan Danchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.