Embedding pdf into html5 pages with a customed interface, still being interractable

只谈情不闲聊 提交于 2019-12-24 21:04:44

问题


So, I need a way to simply implement .pdf into html5 pages. Unfortunatly, , , etc. renders messy and unpractical pdf. (And it's ugly).

I tried to use pdf.js, but it seems too big, and too heavy for what I intend to do. Plus, the lack of documentation makes it very hard to implement correctly.

What I need is:

  1. A way to show one pdf page at a time (which means, no scrolling possible).
  2. As pdf.js seems to turn each pdf page into a picture, it can't be zoomed in without the pdf becoming blurry. What I want is the scaling to update accordingly to the zoom level.
  3. The text must be selectable, word can be searched, etc.
  4. To have no ugly menu that allows to print.
  5. To be able to access to the number of the page being viewed so I can create "next" and "previous" buttons.

So, should I keep trying to set up pdf.js, or is there a better, easier option to do what I need to do, listed above?


回答1:


I suggest you to bringup your software following these guidelines (in order to NOT use PDF.js...it is complex and very slow).Your software will be fast and cross-platform performance indipendent

  1. Create a page that read an input parameter (filename on local filesystem)
  2. Pass to the page the PDF you want to view
  3. On server side, read the file and convert to svg (1 per page). I can suggest you pdf2svg https://github.com/dawbarton/pdf2svg
  4. The same page has to output an HTML page containing the created SVG images formatted with you CSS rules like you want

Finally, you can start to work on toolbar,functionality, etc...



来源:https://stackoverflow.com/questions/52334481/embedding-pdf-into-html5-pages-with-a-customed-interface-still-being-interracta

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