我有这个css:
@page {
size: letter;
margin: 15mm;
@top-center {
font-family: Arial Unicode MS;
content: "Header stuff- blah blah";
}
@bottom-center {
content: "Page " counter(page) " of " counter(pages);
}
}
我有一个转换为PDF的Visualforce页面,CSS在每个页面的底部都提供了一个页面计数器。最终,VF页面中只包含html。
我想在每个页面上添加一个显示在页面计数器上方页脚中的URL,但我无法弄明白。
有什么想法吗?
谢谢!
答案 0 :(得分:1)
你需要两件事:
content
中通常不允许的换行符,可以使用\A
(十六进制中的A =十进制中的十进制数。"新行",通常显示为\n
是ASCII表中的第10个字符)你需要尊重新行,开箱即用的多个空格,标签等在HTML中被忽略(这就是我们使用<br>
等的原因)
<apex:page sidebar="false" showHeader="false" applyHtmlTag="false"
standardStylesheets="false" readonly="true"
renderAs="pdf">
<html>
<head>
<style type="text/css">
@page {
size: A5 landscape;
@bottom-right {
content: "https://stackoverflow.com\A" counter(page) " of " counter(pages);
white-space: pre-line;
}
}
</style>
</head>
</html>
</apex:page>