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

ReactPDF.renderToStream Not working when files are larger than 13MB #2055

Closed
airidasj opened this issue Oct 14, 2022 · 8 comments
Closed

ReactPDF.renderToStream Not working when files are larger than 13MB #2055

airidasj opened this issue Oct 14, 2022 · 8 comments

Comments

@airidasj
Copy link

Describe the bug
RenderToStream / renderToString / renderToString does not Work with bigger fileSize.

To Reproduce
In our case we make an invoice for products and we include more images of the product (4) to a single pdf page. When we render 2-3 products, pdf renders with no issues.

When we add 4-10 products, and the image files increase PDF file size, the renderToStream function stops, and never produces a result.

We can render the pdf on the browser successfully, no matter the filezsize. Doesnt work in Node API.

Desktop (please complete the following information):

  • OS: [e.g. MacOS M1]
  • Trying to render in Backend (Node Js server environment)
  • React-pdf version [e.g. v3.0.0]
@airidasj
Copy link
Author

The function does not produce any errors. It just hangs with no output.

@anwarjaved
Copy link

anwarjaved commented Oct 15, 2022

Yes, I am facing the same issue with generating pdf with lots of images

I am using Node v14.17.5 on Windows

@ghost
Copy link

ghost commented Oct 17, 2022

Can you try running on a Docker container with platform platform=linux/amd64 ?

@airidasj
Copy link
Author

airidasj commented Nov 7, 2022

Tested on platform=linux/amd64.

Works fine on Linux.

Seems to be an issue on Apple M1 (and Windows, regarding previous comment).

@ghost
Copy link

ghost commented Nov 8, 2022

@airidasj I think it's may be due to some dependency is not supports M1 (arm64) yet. We got issues with node-canvas not working on M1.

@diegomura
Copy link
Owner

How can I replicate this?

@anwarjaved
Copy link

How can I replicate this?

Just need to render lots of images like 10-12 of 1MB size or more

@diegomura
Copy link
Owner

I gave this a try here. Rendered way more than what you suggested. Final file is +100mb, and it works fine and rendered pretty fast. Error must be somewhere else in your document (for which I'll need a way to reproduce it). Maybe it's fixed in latest versions

PR has the document for a web app, but I tested rendering it with renderToStream locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants