Jump to page in PDF.js with javascript

前端 未结 3 1104
悲&欢浪女
悲&欢浪女 2021-02-04 21:00

I\'m trying to use PDF.js\' viewer to display pdf files on a page.

I\'ve gotten everything working, but I would like to be able to \'jump to\' a specific page in the pdf

3条回答
  •  臣服心动
    2021-02-04 21:24

    In my case I was loading pdf file inside iframe so I had to do it in other way around.

    function goToPage(desiredPage){
    var frame_1 = window.frames["iframe-name"];
    var frameObject = document.getElementById("iframe-id").contentWindow;
    frameObject.PDFViewerApplication.page = desired page;
    }
    

提交回复
热议问题