Use electron instead of phantomjs
Closed this issue · 9 comments
fengmk2 commented
https://npm.taobao.org/package/electron
Then we can publish 1.0.0 version.
fengmk2 commented
fengmk2 commented
demo 还是挺简单的
'use strict';
const fs = require('fs');
const screenshot = require('electron-screenshot-service');
screenshot({
url: 'https://npm.taobao.org',
width : 1024,
height : 768,
page: true,
})
.then(img => {
console.log(img);
fs.writeFileSync(__dirname + '/out.png', img.data);
screenshot.close();
});
shepherdwind commented
electron 依赖 x11 ,大多数服务器都不带 x11 的,会截图失败的。
fengmk2 commented
@shepherdwind 截图服务做到 qcloud 上,不需要线上服务器。
ibigbug commented
shepherdwind commented
xvfb 这个没法安装到生产环节,主要我们 pe 不让安装自定义软件,这样不方便扩容。
lizzie commented
cli 中调用 electron 截图,会切窗口截图完又跳不回原窗口,这个怎么解?
atian25 commented