-
-
Notifications
You must be signed in to change notification settings - Fork 886
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
"Canvas area exceeds the maximum limit (width * height > 16777216)." on iOS #1149
Comments
I don't see what I could do about this. I could only... Add another warning? |
@wojtekmaj could you set the canvas on iOS Safari to be of max 16.777.216 pixels? So that the limit is never exceeded |
There's an NPM package that people can use to detect the maximum canvas size supported by the web browser:
Users of I have never used it, myself. In my case, I was running into issues on iOS when trying to render a PDF using this element: <Page width={8.5 * 300} /* ... */ /> // in which case, the height becomes 11 * 300, since the pages are Letter-sized As a temporary workaround, I am using the following "smaller" element, which works on iOS: <Page width={8.5 * 72} /* ... */ /> // in which case, the height becomes 11 * 72, since the pages are Letter-sized I plan to employ the above package in the future, but haven't gotten around to it yet (due to some higher priorities). Edit: Changed |
In 45a19b6, I've added a way to override By setting this value manually we can lower the resolution of the canvas rendered, vastly reducing the number of pixels rendered, without changing actual physical canvas size. For example, sample document on an iPhone renders 4,508,910 pixels, setting Bonus tip: you could cap This might help you out! |
@wojtekmaj thank you! We will try this and let you know. |
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days. |
This issue was closed because it has been stalled for 14 days with no activity. |
Just a heads up: there's also maxImageSize option you can pass to options that might be helpful, but I didn't experiment with it a lot. |
If anyone is still having problems, I managed to solve it by changing the renderMode to "svg" |
@focusaway SVG render mode is deprecated, and will be removed in a future version. |
I had been trying to find a solution to this for many days, and I succeeded thanks to your tip. Thank you! |
Before you start - checklist
Description
On iOS mobile + Safari (bug has been reported on iPhone 12, 13, 14), it can happen that the PDF does not display at all.
We tracked down the issue and here is the reason:
More information about the issue: https://pqina.nl/blog/canvas-area-exceeds-the-maximum-limit/
Steps to reproduce
Here is some dummy code to produce the error:
Here is our actual code:
Expected behavior
The PDF should display fine. Like this:
Actual behavior
PDF doesn't display and we're getting the following error in the console:
Attaching the incriminated PDF that doesn't display on Safari / iOS:
Trashless Business Plan 10-28-22.pdf
Additional information
No response
Environment
The text was updated successfully, but these errors were encountered: