飞碟隐藏首页页眉和页脚
我一直在玩飞碟 R8,并尝试隐藏 PDF 首页的页眉和页脚。
我按照提示尝试遵循 W3C 规范内容:element() (W3C 运行元素) 在我的 print.css 中。据描述,以下内容应该可以解决我的问题:
@page { @top-center { content: element(header, first-except) }}
但似乎这尚未在 R8 中实现。所以我尝试使用 set-string 方法来实现上面的方法。
#header { set-string: header content() }
@page { @top-center { content: string(header, first-except) }}
但没有任何内容被渲染, content: string() 似乎被破坏了,因为我放入其中的任何内容都不会被渲染:
@page { @top-center { content: "foo" string(header, first-except) }} /*broken*/
@page { @top-center { content: "foo" string(header) }} /*broken*/
@page { @top-center { content: "foo" }} /*works!*/
那么有人知道如何让它工作吗?
I've been playing with the flying saucer R8 and tried to hide header and footer from the front page of my PDF.
I followed that hint tried to follow the W3C specifications for the content: element() (W3C running elements) in my print.css. It is described that the following should solve my problem:
@page { @top-center { content: element(header, first-except) }}
But it seems that this is not yet implemented in R8. So I tried the approach above with the set-string method.
#header { set-string: header content() }
@page { @top-center { content: string(header, first-except) }}
But nothing gets rendered, content: string() seems to be broken, since whatever I put in there will not be rendered:
@page { @top-center { content: "foo" string(header, first-except) }} /*broken*/
@page { @top-center { content: "foo" string(header) }} /*broken*/
@page { @top-center { content: "foo" }} /*works!*/
So has anyone an idea how to get this working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,解决方案很简单。我从飞碟手册来源复制了它 链接
我必须执行以下操作:
添加第二个不带页码的页脚:
技巧是 CSS @page :first:
除第一个带有不同的页脚。
Ok, the soulution was easy. I copied it from the flying saucer manual sources link
I had to do the following:
add a second footer without the page numbering:
The trick is the CSS @page :first:
There is a normal footer for all the pages except the first one, that comes with a different footer.
这似乎对我有用。我最初错过的关键是 #cover 元素上的 string-set 属性。它还展示了如何进行页计数器。 #cover 元素位于我的封面页上,导致第一页上的计数器递增,即使未显示页脚。
This seems to work for me. The key thing I missed initially was the string-set property on the #cover element. It also shows how to do the page counter. The #cover element is on my cover page resulting in the counter incrementing on page one even though the footer is not being shown.