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
close icon

Footer Not Showing

My company is using 5.102.0.51, and when using your demo code, if I remove the page numbering item (#p;), the footer does not print.

Sample code:
public void FooterIssue()
{
PDFDocument _pdfDocument = new PDFDocument();
_pdfDocument.Compression = CompressionLevel.Best;
_pdfDocument.FileFormat = FileFormat.Format1_4;
_pdfDocument.Properties.Producer = "MyLeo";
_pdfDocument.Margins.Bottom = 50f;
_pdfDocument.AutoCreatePages = true;

IPDFFont font = _pdfDocument.Fonts.Add(FontBaseFamily.Helvetica);
font.Size = 12;

//Set properties for template box
IPDFGraphicState templateProps = _pdfDocument.CreateGraphicState();
templateProps.BackColor = new PDFColor(Color.White);

//IPDFGraphicState is used for setting properties of all drawing objects.
IPDFGraphicState props = _pdfDocument.CreateGraphicState();
props.BreakBehavior = AutoBreakBehavior.MultiLineTextBreak;

SizeF sizer = new SizeF(_pdfDocument.LastPage.DrawingWidth, 40);

PDFTemplateArea header = _pdfDocument.Templates.Add(sizer);
header.Graphics.DrawMultiText(new PointF(0, 0), sizer, "Header " + DateTime.Now.ToLongTimeString(), font, props);
_pdfDocument.Templates.Header = header;

// THIS WORKS
//AddFooter(_pdfDocument, "Something #p;");
//_pdfDocument.Save(@"D:\Projects\MyLeo\build\temp\footertest_with.pdf");

// THIS DOESN'T
AddFooter(_pdfDocument, "Something");
_pdfDocument.Save(@"D:\Projects\MyLeo\build\temp\footertest_without.pdf");
}

private void AddFooter(PDFDocument doc, string FooterText)
{
PDFTemplateArea footer = doc.Templates.Add(new SizeF(
doc.LastPage.DrawingWidth, 40));

IPDFFont font = doc.Fonts.Add(FontBaseFamily.HelveticaBold);
font.Size = 10;
string text = FooterText;
SizeF size = footer.Graphics.MeasureString(text, font);
RectangleF bounds = new RectangleF(0, 15,
footer.Size.Width, footer.Size.Height);
IPDFGraphicState props = doc.CreateGraphicState();
props.TextAlignment = TextAlignment.Right;
props.BreakBehavior = AutoBreakBehavior.Cropping;

footer.Graphics.DrawMultiText(bounds, text, font, props);

doc.Templates.Footer = footer;
}


1 Reply

SS Sri Subhashini M Syncfusion Team July 3, 2008 08:34 AM UTC

Hi,

Thank you for using Syncfusion product.

Footer is not displaying properly.

The issue which is mentioned here is a defect, but the issue got fixed in the version 5.2.0.25. I would like to recommend you to upgrade to the version 5.2.0.25. You can download Essential Studio PDF 5.2.0.25 version from the below thread:

http://www2.syncfusion.com/installs/v5.2.0.25/syncfusionessentialstudiosetup.exe

Unlock key :

If your Essential Studio license is current, you will be able to obtain the key to install this version from your account in DirectTrac. Otherwise please contact your Syncfusion Sales Representative or e-mail salessupport@syncfusion.com.

Please let me know if you need any further assistance.

Regards,
Suba


Loader.
Live Chat Icon For mobile
Up arrow icon