I am successfully converting many URLs to PDFs, then merging them into 1 PDF. However, I am struggling to have the footer page numbers be accurate for the entire PDF. How can the footer know how many pages there are in the entire PDF because it is made up of so many PDFs merged together? Although there are 15 pages in the entire PDF, I am seeing page 1 of 2, then page 2 of 2, then page 1 of 3, etc.; it keeps restarting.
PdfDocument doc = new PdfDocument();
HtmlToPdfOptions opts = new HtmlToPdfOptions();
opts.HeaderHtmlFormat = String.Format(@"<center><br/><b>Date:</b>{0}<br/><br/><b>Event:</b>{1}<br/><b>Username:</b>{2}</center>",
System.DateTime.Now.ToString("dd-MMM-yyyy h:mm:sstt"), "R2342335644", username);
opts.FooterHtmlFormat = @"
<hr />
<div style=""text-align:center"">
Page {page_number}/{total_pages}
</div>
";
opts.RepeatTableHeaderAndFooter = true;
HtmlToPdf.Options.Follow(HtmlToPdf.ConvertUrl(@"http://CRF/Default.aspx?SelectedID=2097873", doc, opts));
HtmlToPdf.Options.Follow(HtmlToPdf.ConvertUrl(@"http://CRF/Default.aspx?SelectedID=2098829", doc, opts));
HtmlToPdf.Options.Follow(HtmlToPdf.ConvertUrl(@"http://
CRF/Default.aspx?SelectedID=2098908", doc, opts));
HtmlToPdf.Options.Follow(HtmlToPdf.ConvertUrl(@"http://EventAuditTrail.aspx?EventID=2097849", doc, opts));
HtmlToPdf.Options.Follow(HtmlToPdf.ConvertUrl(@"http://ManageOneEvent.aspx?EventID=2097849", doc, opts));
HtmlToPdf.Options.Follow(HtmlToPdf.ConvertUrl(@"http://CRF/AdjFormsForEvent.aspx?EventID=2097849", doc, opts));
HtmlToPdf.Options.Follow(HtmlToPdf.ConvertUrl(@"http://CRF/ClinicalCRFs.aspx?EventID=2097849", doc, opts));
HtmlToPdf.Options.Follow(HtmlToPdf.ConvertUrl(@"http://SourceDocs/SourceDocs.aspx?EventID=2048446", doc, opts));
doc.Save(@"c:\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\Event.pdf");