Prince PDF 页脚不显示

发布于 2024-09-05 21:31:45 字数 381 浏览 2 评论 0原文

我正在使用 Prince 生成 PDF。我使用下面的样式表(更大的 css 文件的一部分)在包含页码的每个页面上包含页脚,但页脚没有出现。

所以问题是,我做错了什么?

@page {
  size: A4;
  margin: 24mm 22mm;
  padding: 0;     

 @bottom-left
 {
  content: "Page " counter(page) " of " counter(pages);
  font-size: 7pt;
  font-family: Arial, Helvetica, sans-serif;
  text-align: left;
  white-space:nowrap;
  color:Red;
 }
}

I'm generating a PDF using Prince. I'm using the below stylesheet (part of a much larger css file) to include a footer on each page containing page numbers, but the footer doesn't appear.

So the question is, what am I doing wrong?

@page {
  size: A4;
  margin: 24mm 22mm;
  padding: 0;     

 @bottom-left
 {
  content: "Page " counter(page) " of " counter(pages);
  font-size: 7pt;
  font-family: Arial, Helvetica, sans-serif;
  text-align: left;
  white-space:nowrap;
  color:Red;
 }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泪意 2024-09-12 21:31:45

这个影响以 UTF-8 字节顺序标记开头的 CSS 样式表的错误已在 Prince 7.1 中得到修复。

This bug affecting CSS style sheets beginning with the UTF-8 byte order mark has been fixed in Prince 7.1.

无所谓啦 2024-09-12 21:31:45

我发现了问题。我使用的 CSS 文件最初是在 VS.Net 2008 中创建的,但最近在 VS.Net 2010 中进行了编辑,将编码更改为带签名的 UTF-8。一旦我将编码(使用 VS.Net 中的“文件”->“高级保存选项”)更改为 UTF-8(不带签名),页脚就会在生成的 PDF 中正确显示。

显然,Prince 无法处理具有意外编码的文件中的所有 CSS(或者可能无法处理 UTF 签名?)。长话短说——如果一切看起来都很干净,而你快要失去理智了,请检查文件编码。

I discovered the problem. The CSS file I'm using was originally created in VS.Net 2008, but was recently edited in VS.Net 2010, which changed the encoding to UTF-8 with signature. Once I changed the encoding (using File-> Advanced Save Options in VS.Net) to UTF-8 WITHOUT signature the footer appeared correctly in the generated PDF.

Apparently Prince can't handle all of the CSS in a file with an unexpected encoding (or maybe it can't handle a UTF signature?). Long story short - if everything looks Kosher and you're about to lose your mind, check the file encoding.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文