问题
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:
- A way to show one pdf page at a time (which means, no scrolling possible).
- 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.
- The text must be selectable, word can be searched, etc.
- To have no ugly menu that allows to print.
- 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
- Create a page that read an input parameter (filename on local filesystem)
- Pass to the page the PDF you want to view
- On server side, read the file and convert to svg (1 per page). I can suggest you pdf2svg https://github.com/dawbarton/pdf2svg
- 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