Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for considering Aspose.
As far I have understood from you requirement, you want to add the footer section on every page of Pdf. For information in adding Footer section please visit Set Page Header and Footer
Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for considering Aspose.
As far I have understood from you requirement, you want to add the footer section on every page of Pdf. For information in adding Footer section please visit Set Page Header and Footer
I tested this out using the C# example from the weblink:
[C#]
//Instantiate HeaderFooter object and pass the Section reference in which
//the header or footer is to be added
HeaderFooter hf1 = new HeaderFooter(sec1);
//Set the header of odd pages of the PDF document
sec1.OddHeader = hf1;
//Set the header of even pages of the PDF document
sec1.EvenHeader = hf1;
//Instantiate a Text paragraph that will store the content to show as header
Text text = new Text(hf1,"header");
//Add the text object to the Paragraphs collection of HeaderFooter object to
//display header on the pages of PDF document
hf1.Paragraphs.Add(text);
And then after the last line I tried the following:
pdf.BindHTML(stream_reader);
What I was hoping for was to have the header text to show up on every page. However, what I am getting is a blank page with the header text and the subsequent pages has the information from the stream_reader but they do not have any header text.
Is there a way to bind to html and still have the header/footer functionality work?
Hi,
I think you can achieve it by adding the custome header/footer to every
section of the pdf object. Please try the following sample code:
[C#]
//Bind the html stream to pdf object
pdf.BindHTML(stream_reader);
//add customed header to every section of the pdf object
foreach (Section sec1 in
pdf.Sections)
{
HeaderFooter hf1 = new HeaderFooter(sec1);
//Set the header of odd pages of the PDF document
sec1.OddHeader = hf1;
//Set the header of even pages of the PDF document
sec1.EvenHeader = hf1;
//Instantiate a Text paragraph that will store the content
to show as header
Text text = new Text(hf1, "header");
//Add the text object to the Paragraphs collection of
HeaderFooter object to
//display header on the pages of PDF document
text.TextInfo.Alignment = AlignmentType.Center;
hf1.Paragraphs.Add(text);
}
//Save the pdf
pdf.Save(@"F:/temp/test.pdf");
Please give it a try and feel free to let us know if you have any other
problem.
Thanks.
Best regards.
yes, this worked - thank you.