以electron的nodejs上下文开发此截图功能
关键代码
1 | // web-side |
1 | // server-side |
使用ipc作为客户端和服务端的通讯接口,不过还要改成客户端ipcMain的,旧接口将废弃
require('phantom')引入node模块, github地址:https://github.com/amir20/phantomjs-node1
2
3page.property('plainText').then(function(content) {
console.log(content);
});使用
property功能对viewportSize和clipRect进行设置,page.render(fname)对文件进行输出,fname为路径加名称page.evaluate()回调函数作用域可以访问客户端作用域(既可以访问window、location等对象)