Question

How to call Firefox printpreview using addon SDK. Newest SDK (1.16) not include printultis.js

Thank you somuch

Was it helpful?

Solution

const { getMostRecentBrowserWindow } = require('sdk/window/utils');

var chromewin = getMostRecentBrowserWindow();
chromewin.PrintUtils.printPreview(chromewin.PrintPreviewListener);

OTHER TIPS

const BROWSER = 'navigator:browser' ; 
var {Cc, Ci, Cu} = require("chrome"); 
const WM = Cc['@mozilla.org/appshell/window-mediator;1'].getService(Ci.nsIWindowMediator);
function getMostRecentBrowserWindow() {
return getMostRecentWindow(BROWSER);
}
exports.getMostRecentBrowserWindow = getMostRecentBrowserWindow;  
function getMostRecentWindow(type) {
return WM.getMostRecentWindow(type);
}
exports.getMostRecentWindow = getMostRecentWindow;
var chromewin = getMostRecentBrowserWindow();
chromewin.PrintUtils.printPreview(chromewin.PrintPreviewListener);

This worked

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top