Hi,
as the title says, when printing a Document which is created from a stored DDL the pages are blank.
I use this code to print, it's a slightly modified sample code from the wiki, where I threw out the Preview component since I'm working in a web environment.
Code:
public void Print(Document doc)
{
// Reuse the renderer from the preview
DocumentRenderer renderer = new DocumentRenderer(doc);
if (renderer != null)
{
renderer.PrepareDocument();
int pageCount = renderer.FormattedDocument.PageCount;
// Creates a PrintDocument that simplyfies printing of MigraDoc documents
MigraDocPrintDocument printDocument = new MigraDocPrintDocument(renderer);
printDocument.Renderer = renderer;
printDocument.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.AllPages;
printDocument.PrinterSettings.PrinterName = "Samsung CLP-310 Series";
printDocument.Print();
}
}
The Document is created by using Document = MigraDoc.DocumentObjectModel.IO.DdlReader.DocumentFromString(ddl);
As said when calling this function I get all blank pages, I also have another function to generate the PDF from the same document and that one succeeds, so it's not a defective ddl or something.
What am I doing wrong?