Question

I use PdfSharp/MigraDoc to create and view documents in an application.

I use the WPF version since I need the WPF documentviewer. Now I'd like to print the documents (which works from the DocumentViewer), but for some reason I only get empty pages when I try printing myself.

I use this code to print:

MigraDocPrintDocument printDocument = new MigraDocPrintDocument();
printDocument.Renderer = new DocumentRenderer(druck.GetDruck());
printDocument.Renderer.PrepareDocument();
printDocument.Print();

What do I need to do to print from WPF (from WinForms this worked nicely, but I need WPF for the DocumentViewer).

Was it helpful?

Solution

This is a known bug of MigraDoc 1.31: printing only works if you use the GDI+ build.
As a workaround you can try to use both versions - WPF build for the preview, GDI+ build for direct printing.

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