Print the contents of a form RRS feed

  • Question

  • Using WPF, I have laid out a really nice looking form on the screen. Is there a way to send it more or less as is to the printer? Or do I have to start over from scratch writing print code.
    Friday, January 12, 2007 12:22 AM


All replies

  • Sure, use PrintDialog.PrintVisual or PrintDocument: http://msdn2.microsoft.com/en-us/library/aa969772.aspx

    Friday, January 12, 2007 12:54 AM
  • Does this technique applicable to printing activex content(using winform interop)? can someone clarify this?
    Friday, January 12, 2007 9:25 AM
  • Thanks.

    Do you have any recommedations for learning WPF?

    I am specifically interested in learning the ins and outs of creating data-bound GUI forms that are also printable, but all the books at my local bookstore don't even mention printing.



    Friday, January 12, 2007 7:51 PM
  • I've done this before and I got mixed results with hosting a Windows Forms control inside a WindowsFormsHost then attempting to use PrintVisual on it.

    It does work so you may want to try it (I've never done the ActiveX hosting though).

    Friday, January 12, 2007 8:29 PM
  • The SDK has some of the best print samples you can find:
    e.g. C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples\WPFSamples\DocServices\XpsPrint

    Friday, January 12, 2007 8:34 PM
  • Hi Corbin.


    Tried that. WPF-winform-activex. The result are not what I expected. Inherit interop limitations.



    Monday, January 15, 2007 7:27 AM