13

I'm trying to reset page numbers when I get a special tag in the body of the document (for example when I get a <DIV STYLE="page-break-before:always" />, I'd like the next page footer to say "page 1 of x" where x is the number of pages before the next page break)

In fact it should do exactly the same as if i splitted the body document and converted it separately.

Is there a way to do this?

Making a list of every page-breaks along with their page number would solve this problem, but i don't know if it is possible either.

mmohab
  • 2,303
  • 4
  • 27
  • 43
user1788235
  • 131
  • 3
  • You could look into solving this in the actual header/footer files, if you use custom ones. I haven't tried it but checking where the javascript replaces page numbering you could check that if such a tag exists the numbering would start again? This propably has LOTS of caveats, such as it will not work properly if you need a TOC. – Joel Peltonen Oct 31 '12 at 11:54
  • @Nenotlep Thanks for your fast answer. Actually the javascript only reads values of 'page' and 'topage' given in the url at each call to the header/footer html page (html GET method). As says [the manual](http://madalgo.au.dk/~jakobt/wkhtmltoxdoc/wkhtmltopdf-0.9.9-doc.html) there are a few information given in the url, but that's not enough to help me. – user1788235 Oct 31 '12 at 12:38
  • Did you ever get a solution for this? I am print off multiple forms, and I need to reset my numbering when the form name changes. The header has a different value, but I don't know how to compare to the previous header. Is there a pages array that I haven't been able to discover? – McPhelpsius Sep 29 '16 at 19:06

1 Answers1

-1

I think u can download and modify the html file with some script first, or Just use the C Library Document.

BTW, for html file to pic, I think phantomjs is better than xkhtmltopdf.

Ryan Kung
  • 253
  • 1
  • 6