To Center Elements (PdfPageNumberField , ...)

Hi Syncfusion.com-Team

Is there any way to center the PdfPageNumberField or the PdfPageCountField?

I expected to get the values of the PdfPageNumberField in the
PageAdded-Event, but there is no such Property!
(comparing your documentation?!?)
Your Library does not support to nest the PdfElements?
Why not?
Or is there any Interface i have overlooked?

My first workaround was to create a DataTable with 3 Columns:
left, pagenumber
center, \
right, pagecount

But the values seems to be generated on the clientside?
Is this correct?

1 Reply

AD Administrator Syncfusion Team October 27, 2007 07:31 AM UTC

Hi Frank,

Sorry for the delayed response.

If your intention is to center the PdfPageNumberField , then you can control its location while drawing the footer string in the PDF document using PdfCompositeField.

The following code snippet illustrates this.

[C#]

//Create page number field
PdfPageNumberField pageNumber = new PdfPageNumberField();

//Create page count field
PdfPageCountField count = new PdfPageCountField(font, brush);

// Draw the footer
PdfCompositeField compositeField = new PdfCompositeField(font, brush, "Page {0} of {1}", pageNumber, count);
compositeField.Bounds = footer.Bounds;
compositeField.Draw(footer.Graphics, new PointF(270, 40));

Please refer the sample that shipped with Essential studio in the below location.

[Install drive]:\Documents and Settings\UserName\My Documents\Syncfusion\EssentialStudio\5.2.0.25\Windows\...\HeadersAndFooters

Please let us know if this helps you.

Thank you for your interest in Syncfusion products.

Regards,
Jaya

Loader.
Up arrow icon