Category / Section
How to preserve different headers in even/odd pages?
1 min read
You can add different headers in odd and even pages by using the BeginPageLayoutEventHandler. You can apply headers alternatively in the pages by using EvenTop and OddTop templates. Refer to the following code.
C#:
//Raise begin page event to draw the graphic elements for each page. element.BeginPageLayout += new BeginPageLayoutEventHandler(BeginPageLayout); //Add the different headers in even and odd pages. private void BeginPageLayout(object sender, BeginPageLayoutEventArgs e) { if (index % 2 == 0) { e.Page.Section.Template.EvenTop = AddHeader(document, true); } else { e.Page.Section.Template.OddTop = AddHeader(document, false); } }
Sample Link:
https://www.syncfusion.com/downloads/support/directtrac/general/PdfHeader860416762.zip