From bd555773705de596360114fd811923838b13739f Mon Sep 17 00:00:00 2001 From: Matteljay Date: Sun, 11 Sep 2022 15:37:21 +0200 Subject: [PATCH] Update line_wrapper.js In buffered modus continue printing on the next page, not a necessarily on a completely new blank page. --- lib/line_wrapper.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/line_wrapper.js b/lib/line_wrapper.js index b1e05a3e4..15f0ae538 100644 --- a/lib/line_wrapper.js +++ b/lib/line_wrapper.js @@ -310,7 +310,14 @@ class LineWrapper extends EventEmitter { return false; } - this.document.continueOnNewPage(); + const pageNum = this.document._pageBuffer.indexOf(this.document.page) + if(this.document.options.bufferPages && this.document._pageBuffer[pageNum + 1]) { + this.document.page = this.document._pageBuffer[pageNum + 1] + this.document.y = this.document.page.margins.top; + } else { + this.document.continueOnNewPage(); + } + this.column = 1; this.startY = this.document.page.margins.top; this.maxY = this.document.page.maxY();