BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi Andrew ,
Thank you for using Syncfusion Products.
We can add the page number into Pdf using PdfPageNumberField. Please refer the following code snippet to add the page number in existing pdf .
//Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Append the loaded document
document.Append(loadedDoc);
//Sets the font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f);
//Creates a brush.
PdfBrush brush = PdfBrushes.Black;
//Creates a page number field.
PdfPageNumberField pageNumber = new PdfPageNumberField(font, brush);
for (int i = 0; document.pages.Count; i++)
{
//Draws the page number in the document.
pageNumber.Draw(document.Pages[i].Graphics, new PointF(250,500));
}
Please refer the following link for more details
http://help.syncfusion.com/ug/js/default.htm#!documents/pagenumberfield.htm
Please try this and let us know if you have any further assistance.
Thanks,
Abirami.
Hi Andrew ,
We can draw the page number as Page X(number) of Y (count) using the class PdfCompositeField. Please refer the following code snippet :
//Adds the fields in composite fields.
PdfCompositeField compositeField = new PdfCompositeField(font, brush, "Page {0} of {1}", pageNumber, count);
for (int i = 0; i < document.Pages.Count; i++)
{
//Draws the composite field.
compositeField.Draw(document.Pages[i].Graphics, new PointF (document.Pages[i].GetClientSize().Width/2-20 ,document.Pages[i].GetClientSize().Height-20));
}
We have attached the sample for your reference . Please refer the following link :
http://www.syncfusion.com/downloads/support/directtrac/general/PdfPageNumberSample1587927551.zip
Please try this and let us know if you have any further assistance .
Thanks ,
Abirami.
Hi Andrew,
We are happy know that the last solution worked to you.
Please let us know if you need further assistance.
With Regards,
Praveen