Setting paperSize for PDF printing in Casper

谁都会走 提交于 2019-12-05 02:49:35

You can access paperSize through casper.page.paperSize, however you will need to set this after calling casper.start(), otherwise casper.page will be equal to null.

Here's an example:

var casper = require("casper").create();
casper.start();

casper.page.paperSize = {
  width: '11in',
  height: '8.5in',
  orientation: 'landscape',
  border: '0.4in'
};

casper.thenOpen('http://www.facebook.com/', function() {
  this.capture('test.pdf');
  this.echo('created pdf.');
});

casper.run();
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!