2015-12-07 46 views

回答

0

我想這一定是工作,但不是在文件準備

$(window).load(function() { 
     alert('Loaded'); 
    }); 
0

你必須嘗試在pdfjs git-repo提到textlayerrendered事件。這裏有一個例子:

document.addEventListener('textlayerrendered', function (e) { 
    if (e.detail.pageNumber === PDFViewerApplication.page) { 
     // finished rendering 
    } 
}, true); 
1

你可以使用setTimeout()將執行checkReadyState()功能每200毫秒。 checkReadyState將執行window.print()一旦document.readyStatecomplete

$(document).ready(function() { 
    function isDocumentReady() { 
     if (document.readyState === 'complete') { 
      window.focus(); 
      window.print(); 
      window.close(); 
     } else { 
      setTimeout(isDocumentReady, 200); 
     } 
    } 

    isDocumentReady(); 
}); 
相關問題