铬浏览器:如何设置打印参数(A4 / A3,方向等)?

时间:2012-05-30 10:40:46

标签: css3 printing chromium

使用window.print()?

时,有什么方法可以添加打印参数

1 个答案:

答案 0 :(得分:0)

您可以使用CSS3规则:

@page {
  size: A4 portrait;
  margin: 27mm 16mm 27mm 16mm;
  counter-increment: page;
  @bottom-right {
    content: "Page " counter(page) " of " counter(pages);
  }
}

但是有些用户代理不支持pages计数器,并且会忽略包含该计数器的任何内容,因此要覆盖所有UA,请执行以下操作:

@page {
  size: A4 portrait;
  margin: 27mm 16mm 27mm 16mm;
  counter-increment: page;
  @bottom-right {
    content: "Page " counter(page);
    content: "Page " counter(page) " of " counter(pages);
  }
}

详细了解CSS3分页媒体模块here