Domanda

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

Thank you somuch

È stato utile?

Soluzione

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

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

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top