Question

I have been looking around and I cant find a way to do this as I want.

I have MigraDoc creating a PDF that can be one page or more, the header on the first page I would like to be different to every other page. E.g. First page has a logo and all others do NOT. So I need more then one header. This is something that I have found to do using

Section.PageSetup.DifferentFirstPageHeaderFooter = True

The problem that I have is that this also means that the footer (that will not change at all) does not show up on the first page. For the Footer I am using a table Section.Footers.Primary.AddTable.

I could use a "quick fix" by just copying the table (footer) and pasting it with it changed to section.Footers.FirstPage.AddTable but then I would have a ton of code that is just messy and not needed as the footer does not change, is there a way around this?

Any help would be great. I will continue to look around to see if i can find anything more on this.

Was it helpful?

Solution

You could also use

section.Footers.FirstPage = Section.Footers.Primary.Clone()

after calling AddTable().

Maybe it would be enough to just all section.Footers.FirstPage.AddTable - IIRC the first page footer will be used for all pages if you do not assign a special primary footer (but I could be wrong about this; I'll check this Wednesday or Thursday).

OTHER TIPS

Well, as no one else can answer this the best way I found to "solve" this problem is to create a function that creates the table. Then I call the function and use it as Section.Footers.Primary and section.Footers.FirstPage

If anyone does have a better way please do feel free to give a comment or something.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top