Coder Social home page Coder Social logo

Comments (19)

cxw13424219787 avatar cxw13424219787 commented on May 28, 2024 14
  <pinch-zoom>
    <div class="oat-pdf-container">
      <pdf-viewer [src]="pdfSrc"
        [autoresize]="true" 
        [original-size]="false"
        [show-all]="true"
        [zoom]="currentZoom"
        style="display: block;"
      ></pdf-viewer>
    </div>
  </pinch-zoom>

from ng2-pdf-viewer.

tabirkeland avatar tabirkeland commented on May 28, 2024 3

I implemented this in Ionic 3.9.2 in a modal. Here is a Gist to show how to implement.

from ng2-pdf-viewer.

jtcrowson avatar jtcrowson commented on May 28, 2024 2

I got it to work with pinch (although it's not very smooth), but couldn't get scroll to work with it.

from ng2-pdf-viewer.

michaeljcoyne avatar michaeljcoyne commented on May 28, 2024 1

Any news on this? I can't use this without pinch zoom.

from ng2-pdf-viewer.

hitmacreed avatar hitmacreed commented on May 28, 2024 1

for ionic 3 users here i found an work arround

from ng2-pdf-viewer.

nsuhanshetty avatar nsuhanshetty commented on May 28, 2024

Looking forward to this feature, as I am applying this to a mobile app.

from ng2-pdf-viewer.

liangwenzhong avatar liangwenzhong commented on May 28, 2024

+1

from ng2-pdf-viewer.

jjacobs33589 avatar jjacobs33589 commented on May 28, 2024

I also am looking for this

from ng2-pdf-viewer.

SaeedSyedAli96 avatar SaeedSyedAli96 commented on May 28, 2024

Anyone Implemented this? Help needed!

from ng2-pdf-viewer.

jtcrowson avatar jtcrowson commented on May 28, 2024

@tabirkeland That's with buttons though. What about the pinch gesture?

from ng2-pdf-viewer.

tabirkeland avatar tabirkeland commented on May 28, 2024

@jtcrowson I have not had the chance to try it which pinch.

You could try using the "pinch" gesture outlined here and calling the zoomIn() and zoomOut() functions depending on user input.

from ng2-pdf-viewer.

jtcrowson avatar jtcrowson commented on May 28, 2024

Biggest issue with using a gesture framework (like hammer.js) on the ng2-pdf-viewer is that it disables touch scrolling.

from ng2-pdf-viewer.

sattip avatar sattip commented on May 28, 2024

Any luck?

from ng2-pdf-viewer.

woutervddn avatar woutervddn commented on May 28, 2024

waiting for this as well, tried to get it to work myself but no luck... :(

from ng2-pdf-viewer.

wnabil avatar wnabil commented on May 28, 2024

using hammerjs it is something like that

const container: HTMLElement = document.getElementById('pdf-file-container');

const hammer = new Hammer(container, {
  domEvents: true
});

hammer.get('pinch').set({
  enable: true
});

hammer.on('pinchend', (event: any) => {
  // get the current zoom value
  let zoom = this.currentZoom;
  // get the scaled amount
  const scale = zoom * event.scale / 10;
  // if the user is zooming in
  if (event.additionalEvent === 'pinchout') {
    zoom += scale;
  } else {
    // if zooming out
    zoom -= scale * 10;
  }

  // if zoom is too small or too big set them to max values
  if (zoom < 1) {
    zoom = 1;
  } else if (zoom > 2) {
    zoom = 2;
  }

  // set the current zoom
  this.currentZoom = zoom;
});

i am not sure if there is a better way but this works fine currently

from ng2-pdf-viewer.

cxw13424219787 avatar cxw13424219787 commented on May 28, 2024

using ngx-pinch-zoom, specific query google

from ng2-pdf-viewer.

stale avatar stale commented on May 28, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from ng2-pdf-viewer.

dipankarmondal avatar dipankarmondal commented on May 28, 2024

any one able to do this?

from ng2-pdf-viewer.

cxw13424219787 avatar cxw13424219787 commented on May 28, 2024

from ng2-pdf-viewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.