How to add different header and footer in a PDF Document?
It is possible to add different Header and Footer in different pages of a PDF document in WinForms PDF. To achieve this, multiple sections has to be created using the PdfSection class and the header and footer can be added separately in each section.
The code snippets given below explains how to create multiple sections in a PDF document and add header and footers to it.
C#
//Creating section1 and adding pages to them PdfSection section1 = doc.Sections.Add(); section1.Pages.Add(); section1.Pages.Add(); //Creating section2 and adding pages to them PdfSection section2 = doc.Sections.Add(); section2.Pages.Add(); section2.Pages.Add(); //Including header and footer to the 1st section section1.Template.Top = AddHeader(doc, "Header 1"); section1.Template.Bottom = AddFooter(doc, "Footer 1"); //Including header and footer to the 2nd section section2.Template.Top = AddHeader(doc, "Header 2"); section2.Template.Bottom = AddFooter(doc, "Footer 2");
Please find the working sample in the below link location.
Conclusion
I hope you enjoyed learning about how to add different header and footer in a PDF Document.
You can refer to our WinForms PDF feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!