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

PDF page not rendered properly while the canvas stream is captured #9751

Closed
mind-ranger opened this issue May 23, 2018 · 3 comments
Closed
Labels

Comments

@mind-ranger
Copy link

mind-ranger commented May 23, 2018

If the canvas' stream is captured using canvas.captureStream(), only part of the pdf page content is rendered on the canvas at most time, sometime some text is missing, sometime the picture is missing; If not call captureStream(), pages can be rendered properly.

Configuration:

  • Web browser and its version: Chrome v66
  • Operating system and its version: macOS 10.12.6
  • PDF.js version: 1.10.88
  • Is a browser extension: no

Steps to reproduce the problem:

  1. var stream = document.querySelector('canvas').captureStream()
  2. PDFJS.getDocument(...).then(...)

What is the expected behavior? (add screenshot)
pdf page can be rendered correctly

What went wrong? (add screenshot)

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension):

@timvandermeij
Copy link
Contributor

I'm not entirely sure what captureStream does, but I can only imagine that it's nothing working well with our asynchronous canvas rendering. Rendering the canvas asynchronously can take time and perhaps the stream is cut off too soon?

@wpp
Copy link

wpp commented Dec 10, 2018

I'm experiencing a similar issue with captureStream (on FF and Chrome).
I've used captureStream with no parameter which according to the docs

If not set, a new frame will be captured each time the canvas changes

and I tried doing the requestFrame dance manually

page.render(renderContext).then(mediaStream.requestFrame)

however, certain pages of my PDF's are not being transmitted to the peer.
It's as if the promise resolves to early, because when I page forward/backwards again
the page shows up.

Is there a callback/event for when the canvas has been completely updated? Am I misusing
the promise for page.render()?

@Snuffleupagus
Copy link
Collaborator

Generally speaking, please note that without a runnable example this kind of issue unfortunately isn't really actionable; please see https://github.com/mozilla/pdf.js/blob/master/.github/CONTRIBUTING.md (emphasis mine):

If you are developing a custom solution, first check the examples at https://github.com/mozilla/pdf.js#learning and search existing issues. If this does not help, please prepare a short well-documented example that demonstrates the problem and make it accessible online on your website, JS Bin, GitHub, etc. before opening a new issue or contacting us in the Matrix room -- keep in mind that just code snippets won't help us troubleshoot the problem.

Furthermore, given that captureStream isn't necessary for the PDF.js library itself and that it's quite unlikely that we'd want to make larger changes to the canvas-code (possibly even slowing down and/or complicating general rendering) for such an edge-case; closing this issue as WONTFIX for now.

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

No branches or pull requests

4 participants