Articles in this section
Category / Section

How to add different header and footer in a PDF Document?

1 min read

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.

https://www.syncfusion.com/downloads/support/directtrac/131081/DifferentHeaderAndFooter1982126851.zip

 

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 forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied