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

Option to limit used PixelRatio for use on mobile devices #17170

Closed
CONOVA24 opened this issue Oct 25, 2023 · 1 comment
Closed

Option to limit used PixelRatio for use on mobile devices #17170

CONOVA24 opened this issue Oct 25, 2023 · 1 comment

Comments

@CONOVA24
Copy link

Attach (recommended) or Link to PDF file here:
building-plan.pdf

Configuration:

  • Web browser and its version: Safari
  • Device: iPhone 15 Pro Max
  • Operating system and its version: iOS 17.0.3
  • PDF.js version: 3.11.174

Steps to reproduce the problem:

  1. Open a large pdf (not big file size but large page dimensions) on a device with high pixelratio (i.e. 3 = iPhone)
  2. Zoom in
  3. After a few zooms you run into a warning that the canvas exceeds the maxCanvasPixels and the rendering stops

I know you can set the maxCanvasPixels when initializing the viewer. But it would be great to also limit the max. pixelRatio used to calculate the outputScale and render function. Otherwise you can't zoom in on large pages for example like a construction plan.

Just limiting the pixelRatio (const pixelRatio = Math.min(window.devicePixelRatio || 1, 2);) in the render function and outputScale class to 2 help that I can view the large pdf on the mobile device and zoom in pretty good (and the image quality is fine as well).

Is there a way you can implement that in the upcoming release or is there maybe an even better way to deal with such large page dimensions?

@Snuffleupagus
Copy link
Collaborator

I know you can set the maxCanvasPixels when initializing the viewer.

Yes, and that's the correct/intended solution in your case.

But it would be great to also limit the max. pixelRatio used to calculate the outputScale and render function.

That wouldn't be a good idea, since it could easily lead to poor rendering quality on HiDPI screens.

Otherwise you can't zoom in on large pages for example like a construction plan.

This is already tracked in e.g. issue #6419.

@Snuffleupagus Snuffleupagus closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2023
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

2 participants