我无法显示PDF的所有页面,而不是使用pdf.js的页面
这是显示pdf的代码,我从Traversy Media的教程中复制了此代码,但当前它仅打印出第一页,并且当您单击“下一页”按钮时才转到下一页。但是我想显示PDF的所有页面,而用户不必单击下一页?
<div class="top-bar">
<button class="btn" id="prev-page">
<i class="fas fa-arrow-circle-left"></i> Prev Page
</button>
<button class="btn" id="next-page">
Next Page <i class="fas fa-arrow-circle-right"></i>
</button>
<span class="page-info">
Page <span id="page-num"></span> of <span id="page-count"></span>
</span>
</div>
<canvas id="pdf-render"></canvas>
<script src="https://mozilla.github.io/pdf.js/build/pdf.js"></script>
<script>
const url = 'pdfname.pdf';
let pdfDoc = null,
pageNum = 1,
pageIsRendering = false,
pageNumIsPending = null;
const scale = 1.5,
canvas = document.querySelector('#pdf-render'),
ctx = canvas.getContext('2d');
// Render the page
const renderPage = num => {
pageIsRendering = true;
任何帮助将不胜感激?
相关分类