在 Phantom 中生成 PDF 时,我可以像这样设置纸张大小:
page.paperSize = {
height: '8.5in',
width: '11in',
orientation: 'landscape',
border: '0.4in'
};
然后 page.render(output) 函数会正确生成 PDF。换句话说,大小是正确的,并且它有很多页的大小。
我无法让它在 Casper 中工作(我不确定它是否受支持)。例如,以下内容:
var casper = require('casper').create({
paperSize: {
height: '8.5in',
width: '11in',
orientation: 'landscape',
border: '0.4in'
},
logLevel: 'debug',
verbose: true
});
....this.capture('print.pdf'); ...
创建具有单个非常长页面的 PDF。设置viewportSize并不能解决问题。
有没有办法从 Casperjs 中访问 pageSize 对象?