With RotativaHQ, starting from version 1.3.0, You can create PDF docs with nice headers and footers simply by defining a parameter on ViewAsPdf:
The header and footer view should be complete views (not partial). They can contain anything you could put in a normal view,
@ViewBag variables, the
@Model shared with the main ViewAsPdf, images, css files. Anything useful to customize it and give to your PDF files a professional look.
Header and Footer may also contain special tokens that will be replaced at PDF construction time. For now we have implemented the possibility to add the page number and the total page count. To insert them in footers and headers you should simply add
[page] to get the current page number and
[topage] to get the total page count. A sample header or footer view could look like this: