BlueHatbRit / mdpdf

Markdown to PDF command line app with support for stylesheets

Home Page:https://npmjs.com/package/mdpdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to create a footer with pagination

hervehobbes opened this issue · comments

Hello,

Sorry if this question is obvious but I can't find how to create a footer (for example with an html files), that will contains the current page and the total page number, something like this:

Page {{pageNumber}} / {{totalPages}}

For example

Page 1/5

If I write this inside my html footer, it is rendered, in the PDF, as is...

Thanks by advance

Hi @hervehobbes this is a perfectly valid question. Sadly right now it can't be supported, it used to be when we used Phantom.js to generate our PDF's but since Phantom has been deprecated and development has stopped, we've been forced to move to Chrome Puppeteer. Puppeteer however doesn't support pushing in page numbers into a PDF. It's unspeakably terrible of them but it's what we're left with right now.

I'd really encourage you to open an issue / upvote any existing issues about this on the Puppeteer page because it's really quite a vital component of browsers rendering PDF's.

I'm so sorry we can't support this yet, the moment it's avalible I'll integrate it!

Hello @BlueHatbRit,

Thank you very much for your answer and suggestion.

Bye,
Hervé

Hey Elliot, was wondering if this is supported now in puppeteer. It looks like it to me, but I can't get page numbers to render when I pass mdpdf something like:

"<div><div class='pageNumber'></div> <div>/</div><div class='totalPages'></div></div>"

Maybe I'm just missing something about how puppeteer works here though.

@BlueHatbRit