Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't disable scrollPageIntoView while changing pages in Safari #418

Closed
fncamm opened this issue Dec 5, 2018 · 3 comments
Closed

Can't disable scrollPageIntoView while changing pages in Safari #418

fncamm opened this issue Dec 5, 2018 · 3 comments
Milestone

Comments

@fncamm
Copy link

fncamm commented Dec 5, 2018

Bug Report or Feature Request (mark with an x)
- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [x] Bug report -> please search issues before submitting
- [ ] Feature request
- [ ] Documentation issue or request

On Safari when I change a page by clicking on buttons it automatically scrolls to the start of a pdf page, so the top edge of browser's window matches top edge of the pdf page.
It doesn't work in Chrome, but if I remove <!DOCTYPE html> from the index.html then it works in Chrome.

I'm using version 5.2.3.
Here is code I have.

<pdf-viewer #pdfViewer *pageSelector="let currentPage = page, let showPages = onLoad" class="viewer"
          [src]="src"
          [original-size]="false"
          [fit-to-page]="false"
          [page]="currentPage"
          [zoom]="0.8"
          [render-text]="true"
          [show-all]="false"
          [autoresize]="true"
          (after-load-complete)="showPdf(); pdfViewer.updateSize();"
          (after-load-complete)="showPages($event, holdPage ? currentPage : 1); holdPage = false;">
      </pdf-viewer>

I tried to add [stick-to-page]="false" but it didn't help.

@falinsin
Copy link

falinsin commented Oct 9, 2019

Please, in my case I want not scroll on every page change. Is unconfortable is there any property where desactivate this functionality.
Wy force this scroll on every page change?

@VadimDez VadimDez added this to the 6.0.0 milestone Oct 15, 2019
@VadimDez
Copy link
Owner

@cascesme
Copy link

cascesme commented Oct 2, 2020

I have found a workaround that doesn't involve directly changing the pdfjs module. So what you need to do is to capture on your component the PdfViewerComponent. Then you can access the pdfviewer and inside there is an object call scroll.down and you can set it to false. And that's it you will no longer have scrolling when changing pages.

Angular Component

@ViewChild(PdfViewerComponent, { static: false })
   private pdfComponent: PdfViewerComponent;

initLoadCompleted(pdf: PDFDocumentProxy): void {
       this.pdfComponent.pdfViewer.scroll.down = false;
   }

HTML

<pdf-viewer
                  [src]="pdfData" (after-load-complete)="initLoadCompleted($event)"
                  [render-text]="true"
                  [page]="currentPage"
                  [show-all]="false">
      </pdf-viewer>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants