I'm using PDFSharp/Migradoc to generate PDFs from my web application, and I've managed to get a background image working for the first page of the document.
I start by creating a single section in the document, then rendering an image to this. I then write the document content to paragraph objects inside the same section object.
However, I need to show a different background image for all subsequent pages in the document.
Is this possible? If so, how can I do it?
Answer: In the interest of providing a complete answer, here is the basic code that will get this working:
Section section = this.document.AddSection();
section.PageSetup.DifferentFirstPageHeaderFooter = true;
section.PageSetup.OddAndEvenPagesHeaderFooter = false;
Image firstPageImage = section.Headers.FirstPage.AddImage("firstPage.jpg");
// ...configure image...
Image otherPageImage = section.Headers.Primary.AddImage("everyOtherPage.jpg");
// ...configure image...