Example:
doc = new PDFDocument({size: 'A4', margin: 20});
doc.text("29.12.2015", 600, 20);
Pdfkit get stuck in LineWrapper.prototype.eachWord, because this.spaceLeft is negative:
while (w > this.spaceLeft) {
w = this.wordWidth(word.slice(0, --l));
}
I have the same issue. The expected behavior would be to just ignore the command as it would be printed outside the doc.
Having the same issue. A fix would be apprecited
Any news on this? Stumbled upon this bug as well.
ditto
Referencing this issue.
Is there any work on this being done?
At least a patch that would break the infinite loop and cancel rendering the current text if there is not enough space to render it.
Right not this issue is quite a problem.
As described in #479 - use {lineBreak: false} as a workaround
@blikblum I'm getting this too, please can you give me some directive on what solution should be applied and PR/mergable pretty soon?
There's no PR.
I'll gladly review one
@blikblum Here you have.
I think it MAY also solve: #877, #391 and #386 , but i'm not sure as i 've just looked to the issue titles, not the contents.
I figured this out (with the help of the guide.pdf on the docs). At the end of writing out the entire PDF, I just looped through the pages and added footers (outside of the margins) (remember to buffer the pages)
const doc = new PDFDocument({ bufferPages: true });
...
const range = doc.bufferedPageRange();
for (let i = range.start, end = range.start + range.count; range.start <= end && i < end; i++) {
doc.switchToPage(i);
addFooter(doc, i + 1);
}
@JeremyCraigMartinez I am doing the same thing, but how do you make sure, that text doesn't overflow over the footer?
Most helpful comment
I have the same issue. The expected behavior would be to just ignore the command as it would be printed outside the doc.