获取嵌入式pdf的当前页码 [英] Get Current Page number of Embedded pdf
问题描述
我打算开发一个webapp。该页面的左侧有一个iframe,右侧有一个javascript表单。 iframe将用于从服务器查看pdf。
I am planning to develop a webapp. The page will have an iframe on the left side and javascript form on right side. The iframe will be used to view pdfs from server.
我一直在寻找方法来捕获或获取iframe中正在查看的pdf的当前页码。
I have been looking for ways to capture or get the current page number of the pdf being viewed in the iframe.
这可能吗?
推荐答案
一个建议是尝试并使用 PDF.js ,这是一个使用HTML5构建的PDF查看器。这可能有助于您解决使用iFrame呈现PDF的需求。但是,如果您出于其他原因需要iFrame,请尝试查看PDF.js示例。如之前的stackoverflow所示线程,您可以利用以下功能:
One suggestion would be to try and use PDF.js, a PDF viewer that is built with HTML5. This might help you get around the need to use an iFrame to render the PDFs. But, if you need the iFrame for other reasons, then try looking at the PDF.js examples. As indicated on a previous stackoverflow thread, there are functions you could take advantage of:
PDFJS.getDocument('helloworld.pdf').then(function(pdf) {
// you can now use *pdf* here
pdf.getPage(1).then(function(page) {
// you can now use *page* here
});
});
希望这有助于推动事业发展。
Hope this helps the cause.
这篇关于获取嵌入式pdf的当前页码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!