Section Header

Hello

i have a case that i'm adding multiple sections in pdf document, and these section is set to IsNewPage = false. in this case the section will not show the header if it begin within a page (not in the beginning of the page), is there any approach to force the section to show it's header wherever it gonna start to be rendered?

Hello Younis,

Thanks for using our products.

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 PDFNET-21791 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. We apologize for your inconvenience.

Hello Younis,

Thanks for your patience.

We have made some progress over this issue and have realized that as per current product architecture, the said requirement cannot accomplished because Header can only be placed at the top of a page and it cannot be shown in the middle or somewhere else. Currently if section does not start from a new page (IsNewPage = false), its header will be ignored.
However, If you need the header to be placed where the new section begins and repeated on the next pages, you may use following workaround. For the second section, use table as a container for all its contents. Place header paragraphs in the first row and all remaining section paragraphs items in second row and set Table.IsFirstRowRepeated = true.

[C#]

Pdf pdf1 = new Pdf();
Aspose.Pdf.Section section1 = pdf1.Sections.Add();

section1.Paragraphs.Add(new Text("Sample Text in section 1"));
Aspose.Pdf.HeaderFooter Section1_Header = new Aspose.Pdf.HeaderFooter(section1);
section1.OddHeader = Section1_Header;
section1.EvenHeader = Section1_Header;
Text text = new Text(Section1_Header, "header in section1");
Section1_Header.Paragraphs.Add(text);

Aspose.Pdf.Section section2 = pdf1.Sections.Add();
section2.IsNewPage = false;

Aspose.Pdf.Table table1 = new Aspose.Pdf.Table();
section2.Paragraphs.Add(table1);
table1.ColumnWidths = "500";
// set the value to repeat first row over each subsequent page
table1.IsFirstRowRepeated = true;
Row row1 = table1.Rows.Add();
Cell cell1 = row1.Cells.Add("This is Header of Section #2");

Row row2 = table1.Rows.Add();
Cell cell2 = row2.Cells.Add();
for(int i=1; i<=111; i++)
{
cell2.Paragraphs.Add(new Text("sample line # " + i.ToString()));
}
pdf1.Save(@"d:/pdftest/HeaderFooterIssue_InSection.pdf");

For your reference, I have also attached the resultant PDF that I have generated. In case it does not satisfy your requirement or you have any further query, please feel free to contact. We apologize for the delay and inconvenience.