We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

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

 

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

Article ID: Published Date: Last Revised Date: Platform: Control:
908 04/30/2011 07/10/2014 Windows Forms PDF
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.