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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Platform: WinForms |
Control: PDF |
Published Date: April 30, 2011 |
Last Revised Date: July 10, 2014

 

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

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon 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.Close Icon