erik_buchanan@yahoo.com
Joined: 20 Feb 2009 Posts: 8
|
Posted: Mon Jun 01, 2009 3:11 pm Post subject: DocumentViewer example and using PrintDocument to print |
|
|
Instead of creating an rtf or pdf and then printing I'm trying to work from the DocumentViewer example and create and print a MigraDoc PrintDocument and print from there. I'm working in a browser in evironment not windows forms. Any help at at all would be great.
I keep running into the error
Object reference not set to an instance of an object.
Line 1685: printDocument.Print();
// Reuse the renderer from the preview
ddl = MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToString(document1);
DocumentRenderer renderer = new DocumentRenderer(document1);
if (renderer != null)
{
//int pageCount = renderer.FormattedDocument.PageCount;
// Creates a PrintDocument that simplyfies printing of MigraDoc documents
MigraDocPrintDocument printDocument = new MigraDocPrintDocument();
PrinterSettings printerSettings = new PrinterSettings();
printerSettings.PrintRange = PrintRange.AllPages;
// Attach the current printer settings
// Attach the current document renderer
printDocument.Renderer = renderer;
// Print the document
printDocument.Print();
} |
|