Currently in footer already write page number which are first page : Page 1, second page : Page 2 and so on.
I am trying to achieve is first page : Page 1 and second page: Page 3.
How can I customize those number?
public void GenerateHtmlToPdf()
{
var htmlContent = String.Format("<body>Hello world: {0}</body>",DateTime.Now);
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
htmlToPdf.PageFooterHtml = "<table style=/"border-bottom: 1px solid black; width: 100%/"><tr><td class=/"section/"></td><td style=/"text-align:right/">Page <span class=/"page/"></span></td></tr></table>";
var pdfBytes = htmlToPdf.GeneratePdf(htmlContent);
...
}
There are 2 ways how you can achieve the desired result:
Approach #1
If you can split your content on 2 different HTML inputs (one for the 1st page which should have page number #1, and another one that should start from page number #3) then you can use GeneratePdfFromFiles method and specify for 2nd file that it should start from page number = 3 (with wkhtmltopdf option "--page-offset"):
Approach #2
You may override default JS code (that inserts a page number into
<span class="page"></span>placeholder) in the footer's template. To get an understanding how this JS code works take a look at the wkhtmltopdf help ("Footers And Headers" section): https://wkhtmltopdf.org/usage/wkhtmltopdf.txtHere an example of such override: