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
const pdf = new PDFDocument();
pdf.on("pageAdded", () => {
pdf.text("header");
});
This code will not add the text "header" on the first page as expected. The first by default auto generated page does not
leed to the event "pageAdded" being invoked, thus the callback does not run.
pdfkit version: 0.15.0
Node version: v20.11.0
Browser version (if applicable): serverless (nuxt)
Operating System: Mac OS
The text was updated successfully, but these errors were encountered:
The problem is that the first page is added when the PDFDocument object is created (const pdf = new PDFDocument();), and this correctly triggers pageAdded event. However, the event handler is registered later (pdf.on("pageAdded", ()...).
Bug Report
See title.
This code will not add the text "header" on the first page as expected. The first by default auto generated page does not
leed to the event "pageAdded" being invoked, thus the callback does not run.
The text was updated successfully, but these errors were encountered: