Chrome不支持css @page? [英] Chrome does not support the css @page?

查看:645
本文介绍了Chrome不支持css @page?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b

  @page {
@ top-left {
内容:TOP SECRET;
color:red
}
@ bottom-center {
content:counter(page);
font-style:italic
}
}

但是Chrome打印预览和保存到PDF似乎根本不认识到这一点。如何正确设置页眉和页脚当priting?



编辑: @page 受支持无 ref



但是,我有其他选择来做到这一点吗?我不在网站上工作。该产品只需要一个pdf。我可以接受 chrome webkit plantomjs

解决方案

在我可以确定的情况下,分页媒体的CSS功能主要针对渲染打印的系统,而不是渲染屏幕(浏览器)或浏览器的打印功能。 Prince的一个用于打印的HTML / CSS引擎的例子。所以,@page不会在浏览器中工作,也不会(据我所知)是它的意图。


I have css for print as simple as this:

@page {
  @top-left {
    content: "TOP SECRET";
    color: red
  }
  @bottom-center {
    content: counter(page);
    font-style: italic
  }
}

But the Chrome print preview and save to pdf seems not to recognize this at all. How can I correctly set the header and footer when priting?

EDIT: @page is supported by none ref

However, do I have other choice to do this. I'm not working on websites. The product wants a pdf as result only. I can accept chrome, webkit, plantomjs etc.

解决方案

Near as I can determine, CSS features for paged media are primarily for systems that render for printing, rather than systems that render for the screen (browsers) or the print feature of browsers. An example of an HTML/CSS engine for printing is Prince. So, @page won't work in a browser, nor (as far as I know) was it intended to.

这篇关于Chrome不支持css @page?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆