I have just started evaluating EO.Pdf and so far I am quite impressed.
However, I have run into a couple of problems...
I am trying to create PDF user documentation from multiple HTML sections.
I want to include a
continuous page number at the bottom of each page.
Here is some sample code to show how I am going about this.
Code:
PdfDocument pdfdoc = new PdfDocument();
for (int i = 0; i < 10; i++)
{
string html = String.Format("<h1>Section{0}</h1>",i);
html += "<div style=\"page-break-after: always\">Here is some text</div>";
html += "Here is some more text";
HtmlToPdf.Options.StartPageIndex = pdfdoc.Pages.Count + 1;
HtmlToPdf.Options.FooterHtmlFormat = "<div style='text-align:center'>page {page_number}</div>";
HtmlToPdfResult ret = HtmlToPdf.ConvertHtml(html, pdfdoc);
// HtmlToPdf.Options.Follow(ret);
}
pdfdoc.Save(@"C:\dump\pdftest.pdf");
Unfortunately the page numbers are always numbered starting from page 1 at the beginning of each section.
I have tried setting HtmlToPdf.Options.StartPageIndex but this does not change the {page_number} variable.
I have also tried using HtmlToPdf.Options.Follow() method, which forms a continuous document, but the {page_number} variable still resets to 1 at the start of each conversion.
I may be able to work around this using the AfterRenderPage() handler, but it would be nice not to have to.
Am I doing something wrong, or it this perhaps a bug?
BTW: I have also tried concatenating all my html sections then converting once.
This gives me continuous page numbers, but throws up another problem:
My html sections contain a number of images. When running multiple conversions, these are all included fine. When running a single conversion, the pictures are OK for the first 40 pages of around 180 pages, but then after this all the picutures are blank (although the text layout is leaving correct sized gaps where the images should be).
I will investigate this some more then perhaps post this in a seperate topic.
Many thanks for any help!