You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering significant memory management issues while generating large PDF documents using jsPDF. My use case involves creating a PDF with around 18,000 pages from a 27MB JSON data file. While this works in a local environment, it becomes problematic in serverless environments such as Google Cloud Functions due to memory constraints.
Actual Behavior:
The PDF generation process consumes over 4GB of heap memory, making it impossible to complete in a serverless environment with limited memory. The resulting PDF document object becomes unmanageably large (around 600MB).
I attempted to generate smaller PDFs and merge them using pdf-lib, but this approach complicates maintaining consistent page numbers and links within the document.
Workaround Request:
In the meantime, I am seeking a workaround to manage multiple jsPDF document objects and combine them into a final result. Specifically:
How can I generate multiple smaller jsPDF documents and then combine them into a single final PDF while maintaining consistent page numbers and internal links?
Is there a recommended approach to handle this scenario efficiently?
Environment:
jsPDF Version: 2.5.1
The text was updated successfully, but these errors were encountered:
well here is the thing I don't know the starting and ending, for example, in my data, there is one section of question & answers sometimes this data will be printed on 2 pages, and sometimes it takes more than 10 pages ( I had managed the code that creates pages dynamically based on the data fits in)
There is no question regarding jsPDF capability, but for the larger data if I use only one object of jsPDF this causes me so much heap, all I'm looking for a solution is how I can manage this process into chunks of files and store them temporary combine them at the end while maintaining my page links (i.e textWithLink() ) so individual jsPDF object don't get so much bigger
or there might be some other approach to handle this kind of scenario
Description:
I am encountering significant memory management issues while generating large PDF documents using jsPDF. My use case involves creating a PDF with around 18,000 pages from a 27MB JSON data file. While this works in a local environment, it becomes problematic in serverless environments such as Google Cloud Functions due to memory constraints.
Actual Behavior:
The PDF generation process consumes over 4GB of heap memory, making it impossible to complete in a serverless environment with limited memory. The resulting PDF document object becomes unmanageably large (around 600MB).
I attempted to generate smaller PDFs and merge them using pdf-lib, but this approach complicates maintaining consistent page numbers and links within the document.
Workaround Request:
In the meantime, I am seeking a workaround to manage multiple jsPDF document objects and combine them into a final result. Specifically:
Environment:
The text was updated successfully, but these errors were encountered: