Hi Raveesh,
Drawing Different footers on PDF pageWe can draw the generated images of the “HtmlTable.html” in every page dynamically by using the Pages_PageAdded event handler. The event Pages_PageAdded raised on adding a new page to the PDF document. Kindly refer the below code snippet which demonstrates drawing the different footers on each page,
void Pages_PageAdded(object sender, PageAddedEventArgs args)
{
PdfTemplate footer;
using (HtmlConverter html = new HtmlConverter())
{
// set Javascript
html.EnableJavaScript = true;
using (HtmlToPdfResult result = html.Convert(Server.MapPath('~/Data/HtmlTable.htm'), ImageType.Metafile, (int)doc.Pages[0].GetClientSize().Width, (int)220, AspectRatio.KeepWidth))
{
if (result.RenderedImage == null)
return;
PdfMetafile mf = new PdfMetafile(result.RenderedImage as Metafile);
//Create a page template
footer = new PdfTemplate(new SizeF(doc.Pages[0].GetClientSize().Width, 100));
footer.Graphics.DrawImage(PdfImage.FromImage(result.RenderedImage), new RectangleF(0, 0, doc.Pages[0].GetClientSize().Width, 200));
}
}
args.Page.Graphics.DrawPdfTemplate(footer, new PointF(0, 670));
}
Images with HyperlinksWe can achieve the behavior by using PdfUriAnnotation. We have to draw the URL in the specified page location. Kindly refer the below code snippet to draw the URL in the specified page location,
PdfUriAnnotation url2 = new PdfUriAnnotation(new RectangleF(240, 670, 170, 45));
url2.Uri = '
http://www.Yahoo.com';url2.Border = new PdfAnnotationBorder(0, 0, 0);
url2.Color = new PdfColor(Color.White);
args.Page.Annotations.Add(url2);
Please do find the sample from the below specified location and let me know if you need any information,
http://files.syncfusion.com/samples/PDF.Web/57911_Modified/main.htmRegards,
Suba