views:

900

answers:

3

We use a modified version of the IE engine (the COM version in a C# wrapper) to display a lot of the formatted content in our application. The problem, however, is you don't have a lot of control of any printout of such documents. For example, you can't force a color printout without accessing the registry or directing the user to their Internet Explorer options. So, we've been investigating the new WPF WebBrowser control, which might better suit our purposes.

The problem is (other than Microsoft called it the same name as the Windows Forms version of the control making Google searches less useful than I like) I can't seem to find any good guidelines on how to print the contents of the control. The Document returned from the object isn't paginated, making it hard to use with the PrintDialog. Similar, sending the Visual to PrintDialog doesn't seem like a good idea. Sizing the control properly in this context seems dubious, particularly when you consider paging.

There has to be some good documentation on this somewhere. Can someone direct me to it or provide a good suggestion on how to do this?

+1  A: 

I'm pretty sure the WPF WebBrowser control is just the ActiveX control wrapped up nicely for use in WPF. (The class derives from ActiveXHost).

mackenir
That would be sad... but understandable.
Timothy Khouri
I've gotten the same impression, which implies that my printing options aren't any better than they are now.
Ken Wootton
Well I suppose that's an answer, of sorts ;)
mackenir
A: 

mshtml.IHTMLDocument2 doc = webBrowser.Document as mshtml.IHTMLDocument2; doc.execCommand("Print", true, null);

A: 

what is mshtml?