-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
excessive memory usage when using embedded base64 images #228
Comments
In this case, the pull request must be made to the PDFMake project, which I don't own or manage. I'm using base64 because that's the format required by PDFMake. The PDFMake documentation does not provide any alternative methods for handling images in Node.js, apart from the base64 approach. I'm closing this issue as there’s nothing further I can do on my side. You’ll need to reach out to the PDFMake creator for assistance. Suggestion: You might consider generating your PDF one page at a time and then merging the pages into a single document. Alternatively, you could convert your HTML to a Canvas and export it to a PDF using the |
I don't think so.
Before considering how to implement this in Keep in mind, it might take months before the feature is deployed in those libraries. It’s better to focus on them for now, and once the feature becomes available, let me know — I’ll work on integrating it into my library then 👍🏻 |
I'm encountering a memory issue when generating PDFs with many embedded images using html-to-pdfmake. I have a backend that uses html-to-pdfmake to convert a HTML document with images to JSON for pdfmake generate a pdf document.
Currently, my approach is to embed images in the HTML as base64 strings. However, this results in excessive memory usage because it allocates a lot of memory to store the base64 image strings, often leading to my node server running out of memory.
Questions:
Improvement Proposal:
I was considering opening a PR to improve how images are handled. My idea is to use streams so that pdfmake could consume a stream of bytes instead of relying on base64 strings. This could potentially reduce memory usage significantly.
Would this be a viable improvement for the library? If so, I'd be happy to contribute.
Looking forward to your feedback.
Thanks for your work on this project!
The text was updated successfully, but these errors were encountered: