PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Rendering Document straight to printer
https://forum.pdfsharp.net/viewtopic.php?f=2&t=68
Page 1 of 1

Author:  chrisb [ Tue Jan 30, 2007 12:39 pm ]
Post subject:  Rendering Document straight to printer

Hi,

First of all this is my first post so just wanted to say this is a great component! I was surprised how quickly I could write to code to generate a relatively complex PDF report.

My question regards sending a report directly to the printer - I am creating a MigraDoc.DocumentObjectModel.Document object and adding to it various paragraphs, images and tables etc. and currently rendering it to a file based pdf using a PdfDocumentRenderer.

Is it possible to send this directly to a printer and if so how do I do this please?

Many thanks.

Author:  chrisb [ Tue Jan 30, 2007 1:19 pm ]
Post subject: 

I think I may have answered my own question but maybe you could confirm if this is the best way?

PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer();

Document document = GetPrintableNode().GetDocument();

pdfRenderer.Document = document;

MigraDocPrintDocument printDoc = new MigraDocPrintDocument();

printDoc.Renderer = pdfRenderer.DocumentRenderer;

pdfRenderer.RenderDocument();

using (PrintPreviewDialog f = new PrintPreviewDialog())
{
f.Document = printDoc;
f.ShowDialog();
}

Author:  Stefan Lange [ Fri Mar 09, 2007 12:11 am ]
Post subject: 

The sample DocumentViewer shows how to print directly to a printer.[/b]

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/