We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Footer Text overlapping with Footnote

I’m using Aspose 11.1 pdf version In the below code the footnote text overlaps with the footer text. Expectation is to have footer text below the footnote. I’ve attached the pdf output.

Document pdfDoc = new Document();
pdfDoc.PageInfo.Width = 612.0;
pdfDoc.PageInfo.Height = 792.0;
pdfDoc.PageInfo.Margin = new Aspose.Pdf.MarginInfo();
pdfDoc.PageInfo.Margin.Left = 72;
pdfDoc.PageInfo.Margin.Right = 72;
pdfDoc.PageInfo.Margin.Top = 55;
pdfDoc.PageInfo.Margin.Bottom = 72;

Page pdfPage = pdfDoc.Pages.Add();
pdfPage.PageInfo.Width = 612.0;
pdfPage.PageInfo.Height = 792.0;
pdfPage.PageInfo.Margin = new Aspose.Pdf.MarginInfo();
pdfPage.PageInfo.Margin.Left = 72;
pdfPage.PageInfo.Margin.Right = 72;
pdfPage.PageInfo.Margin.Top = 72;
pdfPage.PageInfo.Margin.Bottom = 72;

Aspose.Pdf.FloatingBox floatBox = new Aspose.Pdf.FloatingBox();
floatBox.Margin = pdfPage.PageInfo.Margin;
pdfPage.Paragraphs.Add(floatBox);

TextFragment fragment = new TextFragment();
fragment.IsInLineParagraph = true;
TextSegment segment = new TextSegment(“When astronauts blast off from the planet Mars, they leave behind Mark Watney (Matt Damon), presumed dead after a fierce storm. With only a meager amount of supplies, the stranded visitor must utilize his wits and spirit to find a way to survive on the hostile planet. Meanwhile, back on”);
segment.TextState.HorizontalAlignment = HorizontalAlignment.Justify;
fragment.Segments.Add(segment);

floatBox.Paragraphs.Add(fragment);

Note fn = new Note();

fragment = new TextFragment();
fragment.IsInLineParagraph = true;
floatBox.Paragraphs.Add(fragment);
fragment.FootNote = fn;
fragment.FootNote.Text = “1”;



TextFragment footnotetext = new TextFragment();
footnotetext.TextState.FontSize = 9;
TextSegment firstSeginsideFnText = new TextSegment(“As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life’s ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life’s ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a”);
firstSeginsideFnText.TextState.HorizontalAlignment = HorizontalAlignment.Justify;
footnotetext.TextState.HorizontalAlignment = HorizontalAlignment.Justify;
footnotetext.Segments.Add(firstSeginsideFnText);
fn.Paragraphs.Add(footnotetext);

fragment = new TextFragment();
fragment.IsInLineParagraph = false;
segment = new TextSegment(“When astronauts blast off from the planet Mars, they leave behind Mark Watney (Matt Damon), presumed dead after a fierce storm. With only a meager amount of supplies, the stranded visitor must utilize his wits and spirit to find a way to survive on the hostile planet. Meanwhile, back on”);

segment.TextState.HorizontalAlignment = HorizontalAlignment.Justify;

fragment.Segments.Add(segment);
floatBox.Paragraphs.Add(fragment);

fn = new Note();

fragment = new TextFragment();
fragment.IsInLineParagraph = true;
floatBox.Paragraphs.Add(fragment);
fragment.FootNote = fn;
fragment.FootNote.Text = “2”;


footnotetext = new TextFragment();
footnotetext.TextState.FontSize = 9;
firstSeginsideFnText = new TextSegment(“As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life’s ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life’s ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a”);
firstSeginsideFnText.TextState.HorizontalAlignment = HorizontalAlignment.Justify;
footnotetext.TextState.HorizontalAlignment = HorizontalAlignment.Justify;
footnotetext.Segments.Add(firstSeginsideFnText);
fn.Paragraphs.Add(footnotetext);

footnotetext = new TextFragment();
footnotetext.TextState.FontSize = 9;
footnotetext.IsInLineParagraph = true;
footnotetext.Hyperlink = new WebHyperlink(“www.google.com”);
footnotetext.TextState.HorizontalAlignment = HorizontalAlignment.Justify;
firstSeginsideFnText = new TextSegment(" testing Hyperlink");
firstSeginsideFnText.TextState.HorizontalAlignment = HorizontalAlignment.Justify;
firstSeginsideFnText.TextState.ForegroundColor = Aspose.Pdf.Color.FromArgb(0, 119, 204);
footnotetext.Segments.Add(firstSeginsideFnText);
fn.Paragraphs.Add(footnotetext);

pdfDoc.Save(@“c:\temp\Footnote.pdf”);

Aspose.Pdf.Document doc = new Document(@“c:\temp\Footnote.pdf”);

foreach (Aspose.Pdf.Page page in doc.Pages)
{
page.Footer = new Aspose.Pdf.HeaderFooter();
page.Footer.Margin = new Aspose.Pdf.MarginInfo();
page.Footer.Margin.Left = 50;
page.Footer.Margin.Right = 50;
page.Footer.Margin.Top = 30;
page.Footer.Margin.Bottom = 10;

{
TextFragment footerText = new TextFragment();
TextSegment footerSegment = new TextSegment(“First Name”);
footerSegment.TextState.FontSize = 12;
footerSegment.TextState.HorizontalAlignment = HorizontalAlignment.Center;

footerText.Segments.Add(footerSegment);
footerText.TextState.HorizontalAlignment = HorizontalAlignment.Center;

page.Footer.Paragraphs.Add(footerText);
}
}

doc.Save(@“c:\temp\Footnote.pdf”);

Hi Prashant,


Thanks for contacting support.

I
have tested the scenario and I am able to notice the same problem. For the sake
of correction, I have logged this problem as PDFNEWNET-40046 in
our issue tracking system. We will further look into the details of this
problem and will keep you updated on the status of correction. Please be
patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNEWNET-40046) have been fixed in Aspose.Pdf for .NET 11.2.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

I downloaded the latest 11.2.0 dll and tried testing this issue. Issue still breaks. I used the same code as posted earlier. Attached is the output with 11.2.0 dll

Hi Prashant,


We are sorry for the inconvenience. Please use following code snippet for the purpose, it will resolve the issue. Please find attached output for reference.

string outFile = “40046.pdf”;<o:p></o:p>

Document pdfDoc = new Document();

pdfDoc.PageInfo.Width = 612.0;

pdfDoc.PageInfo.Height = 792.0;

pdfDoc.PageInfo.Margin = new Aspose.Pdf.MarginInfo();

pdfDoc.PageInfo.Margin.Left = 72;

pdfDoc.PageInfo.Margin.Right = 72;

pdfDoc.PageInfo.Margin.Top = 55;

pdfDoc.PageInfo.Margin.Bottom = 72;

Aspose.Pdf.Page pdfPage = pdfDoc.Pages.Add();

pdfPage.PageInfo.Width = 612.0;

pdfPage.PageInfo.Height = 792.0;

pdfPage.PageInfo.Margin = new Aspose.Pdf.MarginInfo();

pdfPage.PageInfo.Margin.Left = 72;

pdfPage.PageInfo.Margin.Right = 72;

pdfPage.PageInfo.Margin.Top = 72;

pdfPage.PageInfo.Margin.Bottom = 72;

Aspose.Pdf.FloatingBox floatBox = new Aspose.Pdf.FloatingBox();

floatBox.Margin = pdfPage.PageInfo.Margin;

pdfPage.Paragraphs.Add(floatBox);

TextFragment fragment = new TextFragment();

fragment.IsInLineParagraph = true;

TextSegment segment = new TextSegment("When astronauts blast off from the planet Mars, they leave behind Mark Watney (Matt Damon), presumed dead after a fierce storm. With only a meager amount of supplies, the stranded visitor must utilize his wits and spirit to find a way to survive on the hostile planet. Meanwhile, back on");

segment.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

fragment.Segments.Add(segment);

floatBox.Paragraphs.Add(fragment);

Note fn = new Note();

fragment = new TextFragment();

fragment.IsInLineParagraph = true;

floatBox.Paragraphs.Add(fragment);

fragment.FootNote = fn;

fragment.FootNote.Text = "1";

TextFragment footnotetext = new TextFragment();

footnotetext.TextState.FontSize = 9;

TextSegment firstSeginsideFnText = new TextSegment("As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life's ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life's ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a");

firstSeginsideFnText.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

footnotetext.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

footnotetext.Segments.Add(firstSeginsideFnText);

fn.Paragraphs.Add(footnotetext);

fragment = new TextFragment();

fragment.IsInLineParagraph = false;

segment = new TextSegment("When astronauts blast off from the planet Mars, they leave behind Mark Watney (Matt Damon), presumed dead after a fierce storm. With only a meager amount of supplies, the stranded visitor must utilize his wits and spirit to find a way to survive on the hostile planet. Meanwhile, back on");

segment.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

fragment.Segments.Add(segment);

floatBox.Paragraphs.Add(fragment);

fn = new Note();

fragment = new TextFragment();

fragment.IsInLineParagraph = true;

floatBox.Paragraphs.Add(fragment);

fragment.FootNote = fn;

fragment.FootNote.Text = "2";

footnotetext = new TextFragment();

footnotetext.TextState.FontSize = 9;

firstSeginsideFnText = new TextSegment("As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life's ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life's ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a");

firstSeginsideFnText.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

footnotetext.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

footnotetext.Segments.Add(firstSeginsideFnText);

fn.Paragraphs.Add(footnotetext);

footnotetext = new TextFragment();

footnotetext.TextState.FontSize = 9;

footnotetext.IsInLineParagraph = true;

footnotetext.Hyperlink = new WebHyperlink("www.google.com");

footnotetext.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

firstSeginsideFnText = new TextSegment(" testing Hyperlink");

firstSeginsideFnText.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

firstSeginsideFnText.TextState.ForegroundColor = Aspose.Pdf.Color.FromArgb(0, 119, 204);

footnotetext.Segments.Add(firstSeginsideFnText);

fn.Paragraphs.Add(footnotetext);

pdfPage.Footer = new Aspose.Pdf.HeaderFooter();

pdfPage.Footer.Margin = new Aspose.Pdf.MarginInfo();

pdfPage.Footer.Margin.Left = 50;

pdfPage.Footer.Margin.Right = 50;

pdfPage.Footer.Margin.Top = 30;

pdfPage.Footer.Margin.Bottom = 10;

{ TextFragment footerText = new TextFragment(); TextSegment footerSegment = new TextSegment("First Name"); footerSegment.TextState.FontSize = 12; footerSegment.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center; footerText.Segments.Add(footerSegment); footerText.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center; pdfPage.Footer.Paragraphs.Add(footerText); }

pdfDoc.Save(outFile);

Aspose.Pdf.Document doc = new Document(outFile);

doc.Save(outFile);


Please feel free to contact us for any further assistance.

Best Regards,

In the example you have provided, footer is common for all the pages. I have scenario in which 1st page footer is different than the 2nd page. Thats why in my example you will see that i’m adding footer for each page and not adding the constant footer

foreach (Aspose.Pdf.Page page in doc.Pages)
{
page.Footer = new Aspose.Pdf.HeaderFooter();
page.Footer.Margin = new Aspose.Pdf.MarginInfo();
page.Footer.Margin.Left = 50;
page.Footer.Margin.Right = 50;
page.Footer.Margin.Top = 30;
page.Footer.Margin.Bottom = 10;

{
TextFragment footerText = new TextFragment();
TextSegment footerSegment = new TextSegment(“First Name”);
footerSegment.TextState.FontSize = 12;
footerSegment.TextState.HorizontalAlignment = HorizontalAlignment.Center;

footerText.Segments.Add(footerSegment);
footerText.TextState.HorizontalAlignment = HorizontalAlignment.Center;

page.Footer.Paragraphs.Add(footerText);
}
}

Hi Prashant,


Thanks for your feedback. I have checked the scenario again and noticed the reported issue, so reopened the logged issue. Our product team will revisit the issue and will share their findings/ETA as soon as possible. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience caused.

Best Regards,

Hi Prashant,


Thanks for your patience. We have further look into the issue, If you want to add separate Header/Footer for different pages then please use OnPageGenerate event as following, it will help you to accomplish the task.

string outFile = myDir+“40046.pdf”;<o:p></o:p>

Document pdfDoc = new Document();

pdfDoc.PageInfo.Width = 612.0;

pdfDoc.PageInfo.Height = 792.0;

pdfDoc.PageInfo.Margin = new Aspose.Pdf.MarginInfo();

pdfDoc.PageInfo.Margin.Left = 72;

pdfDoc.PageInfo.Margin.Right = 72;

pdfDoc.PageInfo.Margin.Top = 55;

pdfDoc.PageInfo.Margin.Bottom = 72;

Aspose.Pdf.Page pdfPage = pdfDoc.Pages.Add();

pdfPage.PageInfo.Width = 612.0;

pdfPage.PageInfo.Height = 792.0;

pdfPage.PageInfo.Margin = new Aspose.Pdf.MarginInfo();

pdfPage.PageInfo.Margin.Left = 72;

pdfPage.PageInfo.Margin.Right = 72;

pdfPage.PageInfo.Margin.Top = 72;

pdfPage.PageInfo.Margin.Bottom = 72;

pdfPage.OnBeforePageGenerate += OnPageGenerate;

Aspose.Pdf.FloatingBox floatBox = new Aspose.Pdf.FloatingBox();

floatBox.Margin = pdfPage.PageInfo.Margin;

pdfPage.Paragraphs.Add(floatBox);

TextFragment fragment = new TextFragment();

fragment.IsInLineParagraph = true;

TextSegment segment = new TextSegment("When astronauts blast off from the planet Mars, they leave behind Mark Watney (Matt Damon), presumed dead after a fierce storm. With only a meager amount of supplies, the stranded visitor must utilize his wits and spirit to find a way to survive on the hostile planet. Meanwhile, back on");

segment.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

fragment.Segments.Add(segment);

floatBox.Paragraphs.Add(fragment);

Note fn = new Note();

fragment = new TextFragment();

fragment.IsInLineParagraph = true;

floatBox.Paragraphs.Add(fragment);

fragment.FootNote = fn;

fragment.FootNote.Text = "1";

TextFragment footnotetext = new TextFragment();

footnotetext.TextState.FontSize = 9;

TextSegment firstSeginsideFnText = new TextSegment("As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life's ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life's ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a");

firstSeginsideFnText.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

footnotetext.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

footnotetext.Segments.Add(firstSeginsideFnText);

fn.Paragraphs.Add(footnotetext);

fragment = new TextFragment();

fragment.IsInLineParagraph = false;

segment = new TextSegment("When astronauts blast off from the planet Mars, they leave behind Mark Watney (Matt Damon), presumed dead after a fierce storm. With only a meager amount of supplies, the stranded visitor must utilize his wits and spirit to find a way to survive on the hostile planet. Meanwhile, back on");

segment.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

fragment.Segments.Add(segment);

floatBox.Paragraphs.Add(fragment);

fn = new Note();

fragment = new TextFragment();

fragment.IsInLineParagraph = true;

floatBox.Paragraphs.Add(fragment);

fragment.FootNote = fn;

fragment.FootNote.Text = "2";

footnotetext = new TextFragment();

footnotetext.TextState.FontSize = 9;

firstSeginsideFnText = new TextSegment("As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life's ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a As a boy, Philippe Petit dreams of performing daring feats for dazzled crowds. As an adult (Joseph Gordon-Levitt), his life's ambition comes true when he becomes a high-wire artist who stares death in the face with every step. Under the guidance of mentor Papa Rudy, the French daredevil devises a");

firstSeginsideFnText.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

footnotetext.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

footnotetext.Segments.Add(firstSeginsideFnText);

fn.Paragraphs.Add(footnotetext);

footnotetext = new TextFragment();

footnotetext.TextState.FontSize = 9;

footnotetext.IsInLineParagraph = true;

footnotetext.Hyperlink = new WebHyperlink("www.google.com");

footnotetext.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

firstSeginsideFnText = new TextSegment(" testing Hyperlink");

firstSeginsideFnText.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;

firstSeginsideFnText.TextState.ForegroundColor = Aspose.Pdf.Color.FromArgb(0, 119, 204);

footnotetext.Segments.Add(firstSeginsideFnText);

fn.Paragraphs.Add(footnotetext);

pdfDoc.Save(outFile);

----------------------

public static void OnPageGenerate(Aspose.Pdf.Page page)

{

//if (page.Number ==1)

// {

page.Footer = new Aspose.Pdf.HeaderFooter();

page.Footer.Margin = new Aspose.Pdf.MarginInfo();

page.Footer.Margin.Left = 50;

page.Footer.Margin.Right = 50;

page.Footer.Margin.Top = 30;

page.Footer.Margin.Bottom = 10;

{

TextFragment footerText = new TextFragment();

TextSegment footerSegment = new TextSegment("First Name");

footerSegment.TextState.FontSize = 12;

footerSegment.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center;

footerText.Segments.Add(footerSegment);

footerText.TextState.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center;

page.Footer.Paragraphs.Add(footerText);

}

// }

}


Please feel free to contact us for any further assistance.

Best Regards,