我在 Linux 上的 phantomJS 中有一个脚本,它呈现一个示例网站:
var page = require('webpage').create();
page.open('http://www.example.com', function () {
page.render('test.pdf');
console.log('pdf render finished')
phantom.exit();
});
我从 python 调用它:
os.system('phantomjs test.js')
我想要的是让 Python 知道 pdf 渲染已经完成的方法;类似于“pdf 渲染完成”这一行的监听器,或者类似这些行的东西。像这样的回调/侦听器将如何构建以及如何实现?