Skip to content

Displaying PDF inverted #11277

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

Closed
andyalmeida opened this issue Oct 24, 2019 · 3 comments
Closed

Displaying PDF inverted #11277

andyalmeida opened this issue Oct 24, 2019 · 3 comments
Labels

Comments

@andyalmeida
Copy link

andyalmeida commented Oct 24, 2019

Configuration:

  • Web browser and its version: Webview component inside Xamarin.Droid
  • Operating system and its version: Android
  • PDF.js version: 2.2.228

Steps to reproduce the problem:
With the implementation we made (leitor.js) and always using the same PDF file, randomly in PDF preview sometimes opens correctly and sometimes the PDF is displayed vertically and horizontally inverted.

What is the expected behavior? (add screenshot)
Always open the .pdf file in the horizontal / vertical position correctly.

WhatsApp Image 2019-10-24 at 15 55 56

What went wrong? (add screenshot)
The PDF file is being opened upside down on its horizontal and vertical axis.

WhatsApp Image 2019-10-24 at 15 55 57

Link to the code: https://gist.github.com/andyalmeida/95204b703bd1aea4686143a482377e75

@timvandermeij
Copy link
Contributor

You can check if there are warnings/errors in the console, because usually something is printed if this occurs. It looks like either an upstream issue (#5273) or a usage issue (#10521).

@andyalmeida
Copy link
Author

Using the library to render one page at a time as the Previous/Next example, this error occurs. I really couldn't notice nothing wrong with the implementation.

I've changed to display the whole file with an scroll, and it's displaying correctly now.

@timvandermeij
Copy link
Contributor

Looking at this again I think the problem is that you're getting a canvas/context only once and reuse it to render the next page. That's not intended; you should use a new canvas for every page. See also #9430 (comment).

Sorry, something went wrong.

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

2 participants