Is it possible to add different header and footer when table flow to more pages?
It is possible by creating two different documents: one document with a table alone and another document with a different header and footer. Now overlay the header-footer document with the table document.
C#
PdfLoadedDocument ldDoc2 = new PdfLoadedDocument(@''..\..\headerfooter.pdf'');
PdfLoadedDocument ldDoc1 = new PdfLoadedDocument(@''..\..\table.pdf'');
PdfDocument doc = new PdfDocument();
for (int i = 0, count = ldDoc2.Pages.Count; i < count; ++i)
{
PdfPage page = doc.Pages.Add();
page.Section.PageSettings.Margins.All = 0;
PdfGraphics g = page.Graphics;
PdfPageBase lpage = ldDoc2.Pages[i];
PdfTemplate template = lpage.CreateTemplate();
g.DrawPdfTemplate(template, PointF.Empty, page.GetClientSize());
lpage = ldDoc1.Pages[0];
template = lpage.CreateTemplate();
g.DrawPdfTemplate(template, PointF.Empty, page.GetClientSize());
}
VB
Dim ldDoc2 As PdfLoadedDocument = New PdfLoadedDocument( ''..\..\headerfooter.pdf'');
Dim ldDoc1 As PdfLoadedDocument = New PdfLoadedDocument( ''..\..\table.pdf'');
Dim doc As PdfDocument = New PdfDocument()
Dim i As Integer = 0
Dim count As Integer = ldDoc2.Pages.Count
Do While i < count
Dim page As PdfPage = doc.Pages.Add()
page.Section.PageSettings.Margins.All = 0
Dim g As PdfGraphics = page.Graphics
Dim lpage As PdfPageBase = ldDoc2.Pages(i)
Dim template As PdfTemplate = lpage.CreateTemplate()
g.DrawPdfTemplate(template, PointF.Empty, page.GetClientSize())
lpage = ldDoc1.Pages(0)
template = lpage.CreateTemplate()
g.DrawPdfTemplate(template, PointF.Empty, page.GetClientSize())
i += 1
Loop
Sample
http://files.syncfusion.com//samples/KB/PDF.Windows/PDF_TablewithDiffHeader_Footer/main.htm
Note:
Starting with v16.2.0.x, if you reference Syncfusion® assemblies from a trial setup or from the NuGet feed, include a license key in your projects. Refer to the link to learn about generating and registering the Syncfusion® license key in your application to use the components without a trial message.
Conclusion
I hope you enjoyed learning about possible to add different header and footer when table flow to more pages.
You can refer to our PDF feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to create and manipulate data.
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!