【发布时间】:2014-03-28 03:18:44
【问题描述】:
如何使用插件 SDK 调用 Firefox printpreview。 最新 SDK (1.16) 不包含printultis.js
非常感谢
【问题讨论】:
标签: firefox firefox-addon firefox-addon-sdk
如何使用插件 SDK 调用 Firefox printpreview。 最新 SDK (1.16) 不包含printultis.js
非常感谢
【问题讨论】:
标签: firefox firefox-addon firefox-addon-sdk
const { getMostRecentBrowserWindow } = require('sdk/window/utils');
var chromewin = getMostRecentBrowserWindow();
chromewin.PrintUtils.printPreview(chromewin.PrintPreviewListener);
【讨论】:
main.js 可以。自己试试吧。
no authority to load 消息的原因了吗?
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);
成功了
【讨论】: