Hello,
Please find attached sample Pdf file which I create for your reference. And in same file I have added comments what we want.
Thanks,
Jignesh Chauhan
//Create a pdf document.
PdfDocument doc = new PdfDocument();
doc.PageSettings.Margins.All = 0;
AddFooter(doc, PdfPageSize.A4, 50);//you could change the value accroding to the height of footer content
PdfDocument original = new PdfDocument();
original.LoadFromFile(@"F:\testing\pdf form testing\original document\10851Sample.pdf");
PdfPageBase page = null;
foreach (PdfPageBase origianlPage in original.Pages)
{
page = doc.Pages.Add(new SizeF(origianlPage.Size.Width, origianlPage.Size.Height + 50));//add the footerSpace height
origianlPage.CreateTemplate().Draw(page, 0, 0);
}
doc.SaveToFile("10851output.pdf");
System.Diagnostics.Process.Start("10851output.pdf");
}
static void AddFooter(PdfDocument doc, SizeF pageSize, float height)
{
//Create a PdfPageTemplateElement object that will be used as footer space
PdfPageTemplateElement footerSpace = new PdfPageTemplateElement(pageSize.Width, height);
footerSpace.Foreground = true;
doc.Template.Bottom = footerSpace;
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", 9f, FontStyle.Bold), true);
PdfStringFormat format = new PdfStringFormat(PdfTextAlignment.Center);
String footerText = "Copyright © 2017 e-iceblue. All Rights Reserved.";
//Draw text at the center of the page width
float x = pageSize.Width / 2;
//you could adjust this value accroding to your specific requirement.
float y = 0f;
//draw the footer
footerSpace.Graphics.DrawString(footerText, font, PdfBrushes.Black, x, y, format);
}