admin管理员组文章数量:1303529
I'm using PDF.js for rendering my documents on a web app I'm working on.
However I need to enable pinch to zoom on mobile devices for this and it doesn't look like the library itself allows native zooming.
Is there a library that I could use to the code to simulate (at the very least) pinch and zoom on the same scale as the viewers dropdown zoom selection?
I'm using PDF.js for rendering my documents on a web app I'm working on.
However I need to enable pinch to zoom on mobile devices for this and it doesn't look like the library itself allows native zooming.
Is there a library that I could use to the code to simulate (at the very least) pinch and zoom on the same scale as the viewers dropdown zoom selection?
Share Improve this question asked Aug 11, 2014 at 22:14 JordanJordan 3411 gold badge4 silver badges12 bronze badges 3- There is some work done towards SVG backend for PDF.js, see github./mozilla/pdf.js/tree/master/examples/svgviewer -- you might be interested in that instead of generic viewer. – async5 Commented Aug 11, 2014 at 23:05
- 1 Whats the performance like on this. The current viewer that I have just destroys the memory usage (In safari debug mode I had it at 100mb-200mb when scrolling zoomed in). I also managed to get touch events working using the Hammer.js library. However, now when i zoom in past 110% on a mobile device it destroys the text in the pdf (leaves only white pages and blue borders where links used to be) – Jordan Commented Aug 13, 2014 at 2:46
- What version of pdf.js are you using? Have you taken a look at the 'USE_ONLY_CSS_ZOOM' option? See: github./mozilla/pdf.js/issues/2439 and github./mozilla/pdf.js/pull/4834 – Hakkar Commented Sep 12, 2014 at 16:39
1 Answer
Reset to default 4I had found an answer to this solution. I ended up using hammer.js for the pdf.js
http://hammerjs.github.io/
edit
var mc = new Hammer.Manager(myElement, myOptions);
mc.add( new Hammer.Pan({ direction: Hammer.DIRECTION_ALL, threshold: 0 }) );
mc.add( new Hammer.Tap({ event: 'quadrupletap', taps: 4 }) );
mc.on("pan", handlePan);
mc.on("quadrupletap", handleTaps);
本文标签: javascriptPDFjs viewer pinch to zoomStack Overflow
版权声明:本文标题:javascript - PDF.js viewer pinch to zoom - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741739717a2395227.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论