Pregunta

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

Thank you somuch

¿Fue útil?

Solución

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

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

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top