Hi all.
I recently started using EO PDF and my new application concatenates several existing PDF documents into one large PDF. Then, it builds a table of contents (essentially another PDF doc with the index) and finally, it's supposed to add the page numbering to each one of the pages (which could be 1000+, depending on what the user selects)
To add the page number, I'm looping through each page on the document and used an HTMLToPDF.ConvertHTML statement to simply add the page number... and it works, BUT... it takes about 3-5 seconds per page! so, it finished my 1000+ pages in over 1.5 hours.
Is there a faster way to do it?
Here is my actual code:
Code: C#
private void Stamp(PdfDocument document, int offset)
{
int i = 0, PageNumber = 1;
float tmpWidth = 0, tmpHeight = 0;
HtmlToPdfOptions Options = new HtmlToPdfOptions();
foreach (PdfPage Page in document.Pages)
{
if (i > offset) //It may not start the numbering on page 1
{
//if the width or height of the new page are different from the page before, we need to account for them in the Options
if (tmpWidth != Page.Size.Width || tmpHeight != Page.Size.Height)
{
tmpWidth = Page.Size.Width;
tmpHeight = Page.Size.Height;
Options.OutputArea = new RectangleF((tmpWidth / 2), Convert.ToSingle(tmpHeight - 0.3), 10, 2);
}
//Then we add the page number to the page with the specified options
HtmlToPdf.ConvertHtml(PageNumber.ToString(), Page, Options);
PageNumber++;
}
i++;
}
}
Any insight is appreciated...