How to call Firefox printpreview using addon SDK

我只是一个虾纸丫 提交于 2019-12-23 20:23:47

问题


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

Thank you somuch


回答1:


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

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



回答2:


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



来源:https://stackoverflow.com/questions/22703545/how-to-call-firefox-printpreview-using-addon-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!