9
設置爲PAPERSIZE PDF打印在幻影中生成PDF,我可以設置的紙張尺寸是這樣的:在卡斯帕
page.paperSize = {
height: '8.5in',
width: '11in',
orientation: 'landscape',
border: '0.4in'
};
則page.render(輸出)功能適當地生成PDF。換句話說,大小是正確的,並且它有許多頁面的大小。
我不能在卡斯帕工作(我不確定是否支持)。舉例如下:
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對象嗎?
那偉大工程。謝謝 – Jeff
@hexid有沒有辦法在casperjs將頁面保存爲PDF之前將自定義頁眉和頁腳添加到PDF中? – Anagio
@Anagio你可以查看[this](http://stackoverflow.com/q/17125955/395353)問題的例子。 – hexid