Best method to print using wpf 4

Posted by user293545 on Stack Overflow See other posts from Stack Overflow or by user293545
Published on 2011-01-11T21:16:06Z Indexed on 2011/01/11 22:53 UTC
Read the original article Hit count: 148

Filed under:
|
|
|

Howdy, I need to be able to print from my wpf application. I am just trying to print a transaction receipt.

I have found that using

PrintDialog pDialog = new PrintDialog();

pDialog.PrintVisual(new Receipt("transaction name","my store"), "documentTitle");

Does the trick very nicely. "Receipt() is a usercontrol that renders out the transaction details.

How are you meant to do this? is this the correct way? what do I do if I dont know the printer that is going to be used? should I make the usercontrol only as wide as a thermal receipt printer?

Any suggestions would be great!

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wpf