我正在尝试使用 css 设置页脚,我需要有 2 行

I'm trying to set a footer with css and I need to have 2 lines

我有这个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,它出现在每页页面计数器上方的页脚中,但我一直没弄明白。

有什么想法吗?

谢谢!

你需要两件事:

  • 插入通常不允许在 content 中使用的换行符,这可以通过 \A(十六进制的 A = 十进制的 10。"New line",通常显示为 \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://whosebug.com\A" counter(page) " of " counter(pages);
                    white-space: pre-line;
                    }
                }
                </style>
            </head>
        </html>
    </apex:page>