Skip to content

High Memory Usage in pdfmake When Streaming PDF with Multiple Images #2898

Description

@aamir-alii

When generating a PDF containing a large number of images (30–40+), the Node.js process memory usage (RSS) jumps dramatically from ~128 MB to ~1280 MB or higher, eventually leading to an Out-of-Memory crash or the app becoming unresponsive.
Environment

pdfmake version: 0.2.20
Node.js version: 22.14.0
OS: Test on both window and linux

Here is example code

const printer = new PdfPrinter(fonts);
let pdfDoc = await createPDF({
    reports: { data },
  });
 
 const uploadPromise = bunnyStorage.uploadStream(pdfDoc, 'example.pdf');
 pdfDoc.end();
 await uploadPromise;

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions