Articles in this section
Category / Section

Is it possible to add different header and footer when table flow to more pages?

1 min read

 

It can possible by creating two different documents. One document with table alone and another document with 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

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