Search code examples
c#.netpdfpdfsharpmigradoc

Adding a footer with PDFsharp when concatenating pages


I merge PDF documents as shown here: Concatenate Documents (PDFsharp) This example uses PDFsharp to merge the documents. I want to add a footer to each page. I can do this with XGraphics.FromPdfPage(), but it looks extremely complicated as the footer I need is complex (it consists of a table with different formats and styles). I would prefer to render it with MigraDoc's Document instead of PDFsharp's PdfDocument and XGraphics, as it looks much easier to do. Can I do that?

I looked at Mix MigraDoc and PDFsharp but it doesn't look like what I seek. In the example they render MigraDoc over PDFsharp, but I think I need it vice versa.

If XGraphics is the only solution, is there anyway I could zoom the page I'm adding? It will overlap with the footer if I add it as it is - as the page fills whole space.


Solution

  • The Two pages on one sample shows how you can import pages at a reduced size.

    You can use MigraDoc to create pages with just the footers. Open this PDF file with PDFsharp to import the pages from the source files and draw them above the footer.