问题描述
我正在考虑建立一个小型站点,该站点读取一些PDF文件并将其加载到 PDF.js查看器. (我想专门使用查看器)我仍然希望所有查看器UI和功能都存在,只是添加了一个带有文件列表的边栏以供选择.
I am looking into putting together a small site that reads a few PDF files and loads them in the PDF.js viewer. (I want to use the viewer specifically) I still want all of the viewer UI and functionality present, just adding a sidebar with a list of files to chose from.
A,我还无法真正理解PDF.js代码(或为此提供的许多Viewer.js代码)
Alas I have not been able to really understand the PDF.js code (or a lot of the Viewer.js code provided for that matter)
当前,我正在寻找一种将PDF.js查看器传递给新文件的方法.(无需重新加载页面并使用url参数)
Currently I am looking for a way to pass the PDF.js viewer a new file to open. (Without reloading the page and using the url parameter)
话虽如此,但这只是继续该项目的最低限度的功能.
With that said that is only the bare minimum functionality to continue with this project.
我还在寻找一种类似于可用于交互的Viewer/PDF.js函数的函数引用的东西:
I am also looking for something that can resemble a function reference for any of the Viewer / PDF.js functions that can be used for interactions:
- 文件的I/O
- 浏览页面/标题
- 缩放pdf
- 任何事件触发器
我无法直接从 Mozzila的Github Wiki 中找到任何内容.我能够找到的最新教程根本没有使用Viewer.
I haven't been able to find anything direct from Mozzila's Github Wiki. And the recent tutorials that I have been able to find don't make use of the Viewer at all.
推荐答案
要从url打开文件,请执行以下操作:PDFView.open(url,0);
To open a file from a url:PDFView.open(url, 0);
设置页面:PDFView.page = 2;
Set page:PDFView.page = 2;
缩放/缩放:PDFView.zoomIn(10);PDFView.zoomOut(10);
zoom/scale:PDFView.zoomIn(10);PDFView.zoomOut(10);
基本上,只需查看viewer.js中的PDFView对象即可.
Basically just look at the PDFView object in viewer.js.
这篇关于访问PDF.js查看器功能/事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!