2

PrinceXML is really great and powerful but I’m offended by the way it manages header/footer.

I am trying to have 3 columns with different background colours to run on the full page height. 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. 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 ?

fdelaneau
  • 125
  • 1
  • 7

1 Answers1

2

As a DocRaptor developer, we run into these kinds of problems all the time. Prince headers and footers live INSIDE the page margins. 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:

  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.
  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.
jamespaden
  • 448
  • 2
  • 10
  • Right now the best solution I found was to add a background SVG to the @page element but even there the result isn’t perfect and I have a thin white space between the content and the footer. – fdelaneau Dec 28 '17 at 15:57
  • Right now I only tried absolute positioning on the `@bottom-left` element without any luck. Guess I have to try doing the same with the `@top` element. – fdelaneau Dec 28 '17 at 15:59