According to this link I need to Query the web browser object for nsIWebBrowserPrint. Call the nsIWebBrowserPrint::Print() method supplying a print settings object (e.g. that returned from nsIWebBrowserPrint::GetGlobalPrintSettings)
However:
nsIWebBrowserPrint prt = myBrowser as Gecko.nsIWebBrowserPrint;
returns 0
while:
nsIWebBrowserPrint ip = Xpcom.GetInterface<nsIWebBrowserPrint>(myBrowser);
throws an exception (value cannot be null)
Using Geckofx 29 and xulrunner 29
TIA
Use
var print = Xpcom.QueryInterface<nsIWebBrowserPrint>(_browser.Window.DomWindow);
In case it's helpful to you, here is how you can go on to get the print settings:
var service = Xpcom.GetService<nsIPrintSettingsService>("@mozilla.org/gfx/printsettings-service;1");
var printSettings = service.GetNewPrintSettingsAttribute();