Search code examples
javascriptangularngx-extended-pdf-viewer

in angular by default horizontal scroll in ngx-extended-pdf-viewer not working


I want to implement Ngx-extended-pdf-viewer default (horizontal) scroll but I have implemented below code but not working

https://pdfviewer.net/extended-pdf-viewer/display-options

Version: "ngx-extended-pdf-viewer": "^7.3.2",

private _scrollMode = ScrollModeType.horizontal;

public get scrollMode(): ScrollModeType {
  return this._scrollMode;
}

public set scrollMode(mode: ScrollModeType) {
  this.ngZome.run(() => this._scrollMode = mode);
}

constructor(private ngZome: NgZone) {}

Solution

  • Please clone and run this repository: https://github.com/stephanrauh/ngx-extended-pdf-viewer-issues/tree/main/stackoverflow-sanjay. It's my attempt at reproducing your issue. Only it works like charm. So my suggestion is you get my reproducer up and running (just to see if there's a general problem). After that, compare my reproducer to your project. That should help to to find the problem quickly.

    If it doesn't, please open a ticket at https://github.com/stephanrauh/ngx-extended-pdf-viewer/issues and send me a reproducer.

    BTW, you don't need the setter and the getter. That was necessary for my demo, but in your case, a global variable does the trick just as well. The same applies to using NgZone. I needed it in my demo, you in your case, horizontal scroll is the default and it will never change, so you don't need NgZone.