react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

Set custom independent width and height to rendered `canvas` element.

Open wamujlb opened this issue 2 years ago • 0 comments

Before you start - checklist

  • [X] I understand that React-PDF does not aim to be a fully-fledged PDF viewer and is only a tool to make one
  • [X] I have checked if this feature request is not already reported

Description

I'm trying to render PDF on touch devices and the problem is when the canvas becomes more than Canvas area exceeds the maximum limit (width * height > 16777216)., it exceeds the memory limit and stops rendering PDF, sometimes it crash the whole application.

Other than that, I think that the performance on touch devices is very poor. Even on the newest iPhone 13 or OnePlus 10.

Proposed solution

One of the possible solutions would be to provide additional width/height/scale to the canvas, i.e. Page can be 5000x5000, but the canvas is 2000x3000, where width: 100% set by CSS.

Alternatives

Another solution would be to set custom pixel density for the canvas.

Additional information

If you this that this feature is needed I can work on the solution and create a PR.

wamujlb avatar May 16 '22 15:05 wamujlb