Access PDF.js Viewer functions / events

老子叫甜甜 提交于 2020-01-13 05:53:29

问题


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.

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)

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.

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:

  1. I/O of the files
  2. moving through pages / headings
  3. scaling the pdf
  4. any event triggers

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.


回答1:


To open a file from a url: PDFView.open(url, 0);

Set page: PDFView.page = 2;

zoom/scale: PDFView.zoomIn(10); PDFView.zoomOut(10);

Basically just look at the PDFView object in viewer.js.



来源:https://stackoverflow.com/questions/20059153/access-pdf-js-viewer-functions-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!