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

Emit pageChange on MultiPageViewer #510

Merged
merged 1 commit into from
Aug 12, 2019
Merged

Conversation

jain-amit
Copy link
Contributor

This change mirrors the change done for SInglePageViewer

Verified works locally on scrolling, find, zoom and other functionality.

Fixes
Issue #223

@VadimDez
Copy link
Owner

Thank you for the PR!
I've just tried the code, but it seems like the event is not fired. Did you change anything else in the code?

@jain-amit
Copy link
Contributor Author

jain-amit commented Aug 12, 2019

Thanks for the quick response.

I didn't change anything else.

I struggled with making it work until I got the scrollbar to appear.

To get the scrollbar to appear I added display to use flexbox and height that is calculated to fit into the viewable area.

The flexbox in the viewable area lets a toolbar be at the top without moving when scrolling a pdf

Getting the scrollbar was the key to get the event to emit.
This also made the currentPageNumber have the correct value.

This is an example:

    <pdf-viewer
      style="display: flex; height: 80vh"
      [src]="'url'"
      [original-size]="false"
      [render-text]="true"
      [render-text-mode]="RenderTextMode.ENHANCED"
      [show-all]="true"
      (after-load-complete)="afterLoadComplete($event)"
      (pageChange)="pageChanging($event)"
    >
    </pdf-viewer>

@jain-amit
Copy link
Contributor Author

jain-amit commented Aug 12, 2019

Also adding the scrollbar made it so that not all the PDF was rendered immediately for MutliPageViewer. This makes it possible to view very large PDFs on devices with a small amount of memory. There is a rolling window of pages that are rendered.

@VadimDez VadimDez merged commit f3498af into VadimDez:master Aug 12, 2019
@VadimDez VadimDez added this to the 5.3.4 milestone Aug 14, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants