Free Support Forum -

HF not appearing if Sections spans across multiple pages

We are using Aspose Pdf.Net where we are trying to create HF and add other controls as part of the pdf body.

// Header section

Sections sections = request.Pdf.Sections;

Section sec1 = new Section();


Aspose.Pdf.Generator.HeaderFooter hf1 = new Aspose.Pdf.Generator.HeaderFooter(sec1);

sec1.FirstLineIndent = 0;

hf1.IsFirstPageOnly = true;

hf1.DistanceFromEdge = 80;

sec1.IsNewPage = true;

sec1.OddHeader = hf1;

sec1.EvenHeader = hf1;

hf1.DistanceFromEdge = 0.5F;

// Add a table as part and add multiple controls

Aspose.Pdf.Generator.Table tab1 = new Aspose.Pdf.Generator.Table();


Aspose.Pdf.Generator.Table tab2 = new Aspose.Pdf.Generator.Table();

//Add controls so that it splits to the next page

int iterations = 50;
for(int i = 0; i < iterations; i++)
Text textI = new Text("Because the facts of Homer's life -- when he was born or died, where he lived, who he was -- remain unknown and shall most likely never be known, many scholars have doubted the existence of a 'Homer' and point to his texts as the work of a collection of authors over a long period of time. This criticism stems from a disbelief that epics such as The Iliad and The Odyssey could have been formulated, maintained, and transmitted within an oral culture. However, new research on human memory and careful analysis of text reveals evidence that the textual style of each poem does emanate from one author.\n");



HF in the first page is getting displayed properly, but when the text spills into the next page, the header is not getting displayed. only the remaining part of the section content is getting displayed.

Is there a way we can force aspose to display the header if the section in which we are adding header and other contents gets spilled in the next page.



Hi Saikat,

Thanks for your inquiry. In shared code, IsFirstPageOnly property of HeaderFooter object is set to true, so you are getting header only on first page. Please set it to false your issue will be resolved.

Please feel free to contact us for any further assistance.

Best Regards,