Use Migradoc on existing PdfSharp document

1.5k Views Asked by At

I know I can use PdfSharp to render a MigraDoc element but what I need to do is add elements to a manually created PdfDocument using MigraDoc (or something like this):

I have 2 methods, PrintHeader and PrintFooter. Both use Document (migradoc) to add a Header/Footer to my page. This works fine because until now, I was using only MigraDoc to render the PDF file. But now I need to render inside my pdf a HTML fragment. The amazing HTMLRenderer allows me to get a PdfDocument from a HTML but I cannot use the nice MigraDoc positioning facilities on top of it... or can I?

1

There are 1 best solutions below

1
On

Mixing MigraDoc and PDFsharp (your link) also works for externally created PDF files that were opened with PDFsharp.

Apart from that, you can use MigraDoc to create "header" and "footer" as normal paragraphs and use the PDFsharp positioning facilities to place them anywhere on the page.