0

Using pdfkit to build pdf from html page. But first - it's impornant to add some info on each page and to calculate how much pages does it will be in resulting doc?

e.g. I want to add in a footer some info like:


document generated by website.service.com document id: {doc_id}, date: {current_date}, page: 1/3, etc...

and in the header - some logo with useful links.

But I don't get how to add such info because I have only clean html file with logo & css and it seems when you run :

pdf = pdfkit.from_file(filepathin, filepathout)

it creates only one pdf and if filepathin html is long enough (e.g. I have 3 pages) - it doesn't have an option to add headers & footers (colontitles).

If someone know how to realize it - please, give me a link or example.

twistfire
  • 425
  • 1
  • 5
  • 15
  • This looks like your exact question: https://stackoverflow.com/questions/34274637/pdfkit-headers-and-footers. – Jishan Shaikh Jan 09 '22 at 21:38
  • Thank's a lot @KJ. Basic principle is clear. But is it possile to add current pagenum & pagecount to pdf footer for example? – twistfire Jan 10 '22 at 06:25

0 Answers0