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 output pages are black if there is too much data #83

Open
Shlok-Zanwar opened this issue Sep 15, 2023 · 6 comments
Open

Pdf output pages are black if there is too much data #83

Shlok-Zanwar opened this issue Sep 15, 2023 · 6 comments

Comments

@Shlok-Zanwar
Copy link

Amazing package !

I was trying to download a pdf and noticed that the pdf output is black if there is too much data.
To reproduce, You can just duplicate the cards to around 40...50 times in this https://codesandbox.io/s/ancient-violet-sznj9q?file=/src/App.tsx

I noticed that it starts happening after around 20Mb, but not sure.

Thanks!
Great work!

@ivmarcos
Copy link
Owner

ivmarcos commented Sep 21, 2023

Thanks @Shlok-Zanwar for checking this. This happens because of the limitations of the canvas size in the browser, it does not get rendered if the dom is too large, this is mentioned also in https://html2canvas.hertzen.com/faq.. Higher resolutions would make it worse since it scales the height, so this can be avoided with lower resolutions at the moment.

I'm thinking of some possible options to solve that, one idea I have is concatenating multiple elements/canvas into the PDF. If that works, it will be a new feature, looking into it.

@Shlok-Zanwar
Copy link
Author

I understand, Thanks for the response @ivmarcos.

@ycabrera90
Copy link

@ivmarcos excellent job with this package.

I have it in production, and I've encountered this limitation that, in my particular case, prevents me from generating more than 18 pages.

If you have any progress on this, please leave me a comment to know if I can keep this feature in my app.

I'll be attentive.

@anthonyshafto
Copy link

I'm facing the exact same issue. Thanks for the contributions to this thread, and @ivmarcos for the work you have put into creating the package!

@anthonyshafto
Copy link

In case it helps anyone who sees this now, in my case, setting the resolution value to 3 or below worked for me (c. 20 page PDF).

@Gibigbig
Copy link

Gibigbig commented Nov 5, 2024

In case it helps anyone who sees this now, in my case, setting the resolution value to 3 or below worked for me (c. 20 page PDF).

LOW worked for me. Thank you.

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

5 participants