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.
Unfortunately, activation email could not send to your email. Please try again.

Footer issues, margins

Thread ID:

Created:

Updated:

Platform:

Replies:

70484 Dec 12,2007 12:28 PM Dec 18,2007 04:08 AM Windows Forms 2
loading
Tags: PDF
anonymous
Asked On December 12, 2007 12:28 PM

Hello,

Im having some troubles with footers in a PDFDocument.

My document wide bottom margin is set to 60f.

Here is the method I am calling to create the footer:

[code]
private void AddFooter(PdfDocument doc, string footerText)
{
RectangleF rect = new RectangleF(0, 0, doc.Pages[0].GetClientSize().Width, 40);

//Create a page template
PdfPageTemplateElement footer = new PdfPageTemplateElement(rect);

//Set the font
Font f = new Font("Helvetica", 12);
PdfTrueTypeFont font = new PdfTrueTypeFont(f, true);

PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
PdfStringFormat format = new PdfStringFormat();
format.Alignment = PdfTextAlignment.Center;
format.LineAlignment = PdfVerticalAlignment.Bottom;
format.LineLimit = false;

footer.Graphics.DrawString(footerText, font, brush, new RectangleF(0, 25, footer.Width, 40), format);


//Add the footer template at the bottom
doc.Template.Bottom = footer;
[/code]

The problem is, I cannot see the footer. If i highlight the area on the PDF where the footer should be, copy, then paste the text from the footer is pasted. So the correct text is in the PDF document, its just not visible. Its asif something else (the margin maybe?) Is ontop of the footer.

If I change:

[code]
footer.Graphics.DrawString(footerText, font, brush, new RectangleF(0, 25, footer.Width, 40), format);
[/code]

To

[code]
footer.Graphics.DrawString(footerText, font, brush, new RectangleF(0, 4, footer.Width, 40), format);
[/code]

Moving the Y pos of the string to 4, this is where the bottom of the footer text is starting to be cut off.

What am i doing wrong? Is there a property of the margin, or the footer, to display all its contents? As I say, using Y pos of 25 I can highlight the footer, copy the text and this is fine so the text is in the document; its just not visible.

Thanks, any help is very much appreciated.

Best Regards,


Jisha Joy [Syncfusion]
Replied On December 14, 2007 07:07 AM

Hi,

I was able to see the issue of footer is not visible in PDF document . Please create a Direct-Trac incident (mention the forum link in the subject line) so that we will fix this issue and we update you with the fix.

Please let me know if you need further assistance any questions.

Thanks for using Syncfusion product.

Regards,
Jisha



Jisha Joy [Syncfusion]
Replied On December 18, 2007 04:08 AM

Hi,

Thank you for using Syncfusion Products.

On further analysis we found that this is not the issue of Pdf. If Line alignment of String Format is set, then the text will not be visible in the graphics space. This is the default behavior of .Net.

Please refer the sample in the link:
http://websamples.syncfusion.com/samples/PDF.Windows/70484/main.htm

In this sample I have commented out the statement format.LineAlignment, the footer will be displayed correctly and it will be visible to the users.

Kindly try this and let me know if you need further assistance.
Regards,
Jisha


CONFIRMATION

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.

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.

;