Node-html-pdf: id="pageFooter-last" shows on every page

Created on 1 Nov 2017  路  8Comments  路  Source: marcbachmann/node-html-pdf

After upgrading to 2.2.0, an element with the id of pageFooter-last renders on every page.

When generating a PDF with the same markup in version 2.1.0, the footer correctly appeared on the last page only.

Most helpful comment

@alhaag i downgrade my version to 2.1.0

All 8 comments

Hi, Any solution?

I also encountered this problem.
Any solution?

@alhaag i downgrade my version to 2.1.0

thank you @Ashky

It's affect me also :(

Hi, this is the case also when passing options like:

const config = { footer: { height: '28mm', contents: { default: '<p style="color: #444;">Page {{page}}</span>/<span>{{pages}}</p>', last: `myLastPageFooter` } }, };

This is still not working. "pageFooter-2" and the like seem to work, but "pageFooter-last" doesn't.

My guess is it's a dependency problem.

I solved it by, moving the entire npm module ("html-pdf") to a local lib. (bin folder, node_modules folder and all)
And instead of importing/requiring "html-pdf"

var pdf = require("html-pdf");

I used;

var pdf = require("path/to/local/lib/html-pdf/lib/index.js");

This worked for me, so I can use pageFooter-last (and all other wildcards)

I will check out why this solves it, and get back. 馃憤

Was this page helpful?
0 / 5 - 0 ratings