From 34a529a982030e0240195b90234fb430f70f499d Mon Sep 17 00:00:00 2001 From: oskarleonard Date: Mon, 18 May 2020 13:42:43 +0200 Subject: [PATCH] To be able to use the many pages workaround we need to pass in pageNr manually https://github.com/eKoopmans/html2pdf.js/issues/19#issuecomment-484240946 --- src/plugin/hyperlinks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugin/hyperlinks.js b/src/plugin/hyperlinks.js index 8646d23..58b12fa 100644 --- a/src/plugin/hyperlinks.js +++ b/src/plugin/hyperlinks.js @@ -10,7 +10,7 @@ var orig = { toPdf: Worker.prototype.toPdf, }; -Worker.prototype.toContainer = function toContainer() { +Worker.prototype.toContainer = function toContainer(pageNumber) { return orig.toContainer.call(this).then(function toContainer_hyperlink() { // Retrieve hyperlink info if the option is enabled. if (this.opt.enableLinks) { @@ -29,7 +29,7 @@ Worker.prototype.toContainer = function toContainer() { clientRect.left -= containerRect.left; clientRect.top -= containerRect.top; - var page = Math.floor(clientRect.top / this.prop.pageSize.inner.height) + 1; + var page = pageNumber || Math.floor(clientRect.top / this.prop.pageSize.inner.height) + 1; var top = this.opt.margin[0] + clientRect.top % this.prop.pageSize.inner.height; var left = this.opt.margin[1] + clientRect.left;