We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

PdfPageNumberField in PdfGridCell

I want to insert the page number (PdfPageNumberField) into a grid cell (in the grid footer).  Can't figure out how to do that.

3 Replies

AS Abirami Selvan Syncfusion Team August 19, 2015 02:27 PM UTC

Hi Martin,
Thank you for using Syncfusion product.
We do not have support for drawing the page number using PdfNumerField class in a particular PdfGridcell value. Currently , we have the support to draw the text and another grid(nested grid) in a particular grid cell. However you can manually calculate the page number and  set as grid cell value.
You can refer below link for the usage of page number in PDF footer.
http://help.syncfusion.com/ug/windows%20forms/index.html#!Documents/workingwithheaderandfootertemplate.htm
Please let us know if you have any further assistance.
Regards,
Abirami.


MB Martin Bach August 20, 2015 07:43 AM UTC

Hi,

thank you for your anwser.

I do not know how to calculate the page number manually and i do not find anything in the Forums...

Could You explain how to calculate the page number manually?`

Thank You



AS Abirami Selvan Syncfusion Team August 21, 2015 12:28 PM UTC

Hi Martin,
We can calculate the page number using  BeginPageLayout event in PdfGrid. We have created the sample for calculating the page number manually in PdfGrid.
Please refer the below code snippet :
//call the events

pdfGrid.BeginPageLayout+=pdfGrid_BeginPageLayout;

//Draw grid to the page of PDF document.

pdfGrid.Draw(page, new PointF(10, 10), layoutFormat);


private void pdfGrid_BeginPageLayout(object sender, BeginPageLayoutEventArgs e)

{

//Set page number when each page starts
(sender as PdfGrid).Rows[i].Cells[0].Value = "Page - "+pageNumebr.ToString();
}
Please refer the sample in the below link:
http://www.syncfusion.com/downloads/support/forum/119953/ze/MvcApplication11803112166
Please try this and let us know if you have any further assistance.
Regards,
Abirami.


Loader.
Live Chat Icon For mobile
Up arrow icon