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

Render all pages and allow scrolling? #6547

Closed
liuzhen2008 opened this issue Oct 21, 2015 · 4 comments
Closed

Render all pages and allow scrolling? #6547

liuzhen2008 opened this issue Oct 21, 2015 · 4 comments

Comments

@liuzhen2008
Copy link

In the APIs provided, it seems that we can only render the PDFs page by page.

Does that mean if I want to make a view that allows the user to scroll through the whole pdf, I will have to render the pages one by one in a and insert them to a div?

I guess I will have to deal with the paging stuff myself too?

@timvandermeij
Copy link
Contributor

Yes, that is true. The reason is that rendering pages that are out of view is expensive in terms of memory. However, you could do something like the svgviewer does to load all pages: https://github.com/mozilla/pdf.js/blob/master/examples/svgviewer/viewer.js. Closing as answered.

@liuzhen2008
Copy link
Author

@timvandermeij Just curious, I just tested out this svg method, it seems lightning fast comparing to the canvas method. Is there a reason we should use canvas over svg?

@timvandermeij
Copy link
Contributor

The canvas back-end is the back-end that has been supported since the beginning of PDF.js. The SVG back-end is still experimental and cannot do everything that the canvas back-end can do, yet, nor is it as fast and memory efficient. If someone is interested in the SVG back-end to improve its rendering and performance, feel free to open a new PR or contact us on IRC.

@fedyd
Copy link

fedyd commented Mar 6, 2017

I have just started studying Pdf.js and I am a beginner. Does not the default pre-built viewer use canvas instead and allow also to scroll the whole document pages? I just looked inside the file viewer.js and there you can find canvas element and no svg.
Is there an updated way to get a multiple pages document shown with scroll bar? Thank you, Federico

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

3 participants