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

getStreamAsBuffer() does not work anymore for larger file sizes (e.g. PDFKit) #55

Closed
malte94 opened this issue Jun 30, 2023 · 1 comment

Comments

@malte94
Copy link

malte94 commented Jun 30, 2023

Hey there,

The "getStreamAsBuffer()" will not work anymore for larger file sizes.

Here's an exemplary PDF output which includes many elements with a larger text. As soon as the Blob file size exceeds approx. 15743 bytes, nothing is either sent to the frontend or catched as an error.

The doc.end() is always outputted correctly.

When I slice the to a certain amount, the PDF is sent to the frontend correctly.

Thank you!

  // Create a table for each entry in logbook.entries

  doc.fontSize(10);
  doc.text("", doc.x, doc.y + 10);

  logbook.entries
      .filter(element => new Date(element.date).getFullYear() == year)
      .slice(0, 200)
      .forEach(element => {
          doc.text(element.text);
      });

  // Finalize

  doc.end();

  console.log(doc)

  return await getStreamAsBuffer(doc);
@sindresorhus
Copy link
Owner

Duplicate of #52

@sindresorhus sindresorhus marked this as a duplicate of #52 Jul 1, 2023
@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Jul 1, 2023
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

2 participants