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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Display PdfPageNumberField in a PdfGrid Cell

Thread ID:





117609 Nov 15,2014 06:07 AM UTC Nov 18,2014 05:17 PM UTC WinRT 3
Tags: PDF
Mark Schramm
Asked On November 15, 2014 06:07 AM UTC

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

Karthik Krishnaraj [Syncfusion]
Replied On November 17, 2014 12:24 PM UTC

 Hi Mark,

Thank you for your interest in Syncfusion products.

 I have attached a simple sample for your reference regarding how to add page number into grid cell,
 We hope it will be helpful for you, please let me know if you need any further assistance.


Attachment: PdfNumberFieldGridCell_4feb38c1.zip

Mark Schramm
Replied On November 17, 2014 11:02 PM UTC

I'm sorry but the sample project you provided just sticks the page number in the top left hand corner of the page.  If that happened to be where the cell was it was just lucky.

I would think the line: compositeField.Draw(myPage.Graphics)
just dumps the thing on page. while: pageheaderRow.Cells[9].Value = compositeField;
isn't going to do anything as no draw is executed.  Unless I'm misunderstanding some sort of redirection.  Anyway in tests the page number just blots in the top left of the page and it's not useful there.


Karthik Krishnaraj [Syncfusion]
Replied On November 18, 2014 05:17 PM UTC

Hi Mark,


Sorry for the inconvenience caused, for now we don’t have support for adding page number in Pdf Grid at respective cell position, whereas this is possible using PdfLightTable, I have attached a simple sample for your reference can you please check through it and let me know if you need any further assistance, I have included a code snippet about the working of cell layout event below please look through it.

//This event will be called every time when cell is created

private void lightTable_BeginCellLayout(object sender, BeginCellLayoutEventArgs args)


//Use to draw at specified cell index

if (args.CellIndex == 1)


//Getting the boundaries of the Cell

RectangleF rect = new System.Drawing.RectangleF(args.Bounds.X, args.Bounds.Y, args.Bounds.Width, args.Bounds.Height);

//Create page number field

PdfPageNumberField pageNumber = new PdfPageNumberField(font, brush);

PdfPageCountField count = new PdfPageCountField(font, brush);

PdfCompositeField compositeField = new PdfCompositeField(font, brush,Page NO {0}", pageNumber);

//Drawing Page number in  respective boundaries of cell

compositeField.Draw(args.Graphics, new System.Drawing.PointF(rect.X,   rect.Y));





Attachment: PdfNumberField_516eab50.zip


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon