Jordan
Jordan

Reputation: 341

PDF.js viewer pinch to zoom

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?

Upvotes: 11

Views: 15526

Answers (1)

Jordan
Jordan

Reputation: 341

I 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);

Upvotes: 4

Related Questions