0

I am using Rotativa as a wrapper for wkhtmltopdf in order to render an invoice or multiple page report to pdf.

However, when styling the document I encountered two problems.

  • The @page element does not seem very compatible, as when I write for example @page:first, VS2013 complains that it is not a valid pseud-class for css3, and also I see no effect in the results, both in chrome and in the resulting pdf
  • When using a rule in the body of the document (or a wrapper element, for that matter) stating that the height is 297mm (I set A4 in the @page element and in the wkhtmltopdf parameter for page size), I see that the element does not reach the end of the document. Hand tunning the value gives me a practical page height of 351mm.

What I would like to have is a multiple page report where each page has in its bottom a summary of the running total of that page, and a grand total in the last page. So basically I need an element which I can position in the bottom and then I guess I have to manually tune how many rows fit each page.

Anoop B.K
  • 1,484
  • 2
  • 17
  • 31
Arturo Ribes
  • 345
  • 3
  • 15
  • I realised that the size specified in the Rotativa wrappers (passed to the wkHtmlToPdf binary) and which should be in mm, have to be scaled by 1.25 when specified in the CSS. That is, in order to fill the 297mm in height passed to wkhtmltopdf for an A4 page, I have to write 371mm in the CSS file. – Arturo Ribes Aug 31 '15 at 13:07
  • `wkhtmltopdf` uses QtWebKit as a backend for html rendering. You can get an idea of what is supported [here](http://doc.qt.io/qt-4.8/qtwebkit-guide-css.html). I don't see `@page` mentioned anywhere there, though you will still want to verify that you are using the most up-to-date `wkhtmltopdf` [release](http://wkhtmltopdf.org/downloads.html). – Anthony Hilyard Aug 31 '15 at 14:07

0 Answers0