Forum How do I...?

Header and footer that allows HTML content

elvanto
Hi guys,

I'm generating letters that have custom content. This content can span over many pages.

I also want to add a custom header and footer to each page of the letter.

The issue I am facing is header and footers in Prince do not allow you to add HTML and images.

Do you have any suggestion on how I can make this work knowing that the content between the header and footer can be different?

Appreciate your help!

Ben
dauwhe
You can move elements (including child elements, etc.) into running headers or footers. See http://www.princexml.com/doc/page-headers-footers/

@page { 
    @top { content: flow(header) }
}
h1 { flow: static(header) }



Dave
pfurbacher
I realize this answer is late-to-the-party, but you may also use CSS3 "element()/running()" syntax:
@media print {
    @page { 
        @top { content: element(header); }
        . . .
    }
    div.pageHeader {
        position: running(header);
        . . .
    }
}

As a newcomer to Prince (as of yesterday), I was surprised that it didn't seem to implement this, but a search of the forum yielded this: Running Elements. It seems that the "flow()/static()" syntax and implementation in Prince predates the CSS3 "element()/running()" syntax.

It would be good if the docs could be updated to make a note of these two alternatives.