简体   繁体   English

PrinceXML整页背景以及页码

[英]PrinceXML full page background with page numbering

PrinceXML is really great and powerful but I'm offended by the way it manages header/footer. PrinceXML确实很棒而且功能强大,但是我对它管理页眉/页脚的方式感到恼火。

I am trying to have 3 columns with different background colours to run on the full page height. 我正在尝试使3列具有不同的背景颜色在整页高度上运行。 Not a problem until you add a footer to include the page's number. 在添加页脚以包含页面编号之前,这不是问题。

In order to show the footer you need to add a bottom margin to the @page, but doing so cut the columns. 为了显示页脚,您需要在@page处添加一个底边距,但是这样做可以减少列数。 I tried to use an absolute position without any luck. 我尝试使用绝对位置,没有任何运气。

Is there anyone who has some experience with complex layouts and page numbering with PrinceXML ? 有没有谁对使用PrinceXML进行复杂的布局和页面编号有一些经验?

As a DocRaptor developer, we run into these kinds of problems all the time. 作为DocRaptor开发人员,我们一直都遇到这类问题。 Prince headers and footers live INSIDE the page margins. Prince页眉和页脚位于页面边距内。 This provides a lot of useful power, but sometimes complicates things, as you've noted. 如您所注意到的,这提供了很多有用的功能,但有时会使事情变得复杂。

Without seeing your exact HTML, I'd suggest the following: 在没有看到您确切的HTML的情况下,建议您执行以下操作:

  1. Continue experimenting with a zero page margin and absolute positioning and a negative position/margin on the element inside the footer. 继续尝试在页脚内部的元素上使用零页边距和绝对定位以及负位置/边距。 I think this would work. 我认为这会起作用。 It might work better if you used a header element. 如果使用标头元素,它可能会更好。 Prince gets weird and buggy on the edges when you do this kind of tricky stuff. 当您进行此类棘手的操作时,Prince会变得很奇怪和容易出错。
  2. Alternatively, if your column widths are the same for every page/document, try faking the column background colors by using a background-image on @page . 另外,如果每个页面/文档的列宽都相同,请尝试使用@page上的背景图像来伪造列的背景色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM