Forum How do I...?

Repeating a block of content on another page

chrisdarroch
Hey there.

First up, Prince XML makes me happy. It's a far superior solution to any other PDF generator I've found out there.

I have a document to generate that, for legal reasons, mandates that an acknowledgment preamble precedes an area on the same page where concerned parties are required to sign the document.

In case that sentence was too long and confusing (I know, it's a head-spin!), check my attached image for a rough sketch.

layout.gif


Now, this layout will work if there are at most two signatures. If there are any more, the content grouping and page break rules I would have to write would dictate that there's not enough space on this page, and thus will start the content on another one.

The problem is that, of course, the preamble won't be on the second page.

Normally, one would say "oh, if you want it to repeat across pages, just throw it in the header." Sure, seems like it'll work, and I'll probably end up doing that. However, say that each page of the document has to have the same header and footer on them as well...

What I'm after I guess is a way of either:
  • specifying more than one header for a page (or sequence of pages)
  • telling prince that across this section of the document, a specific content block should always precede any of the main content -- in this case, the blocks for parties to place their signature.

Anyone got any suggestions? Here's what i have so far:
The CSS:
@page acknowledgment
  :margin 20em 16mm 27mm 16mm
  
  @top
    :content flow(ack_header)

div#acknowledgment
  :page acknowledgment

  div.preamble
    :flow static(ack_header)
  
  table.things-to-know
    height: 20em
    background-color: #CCC


The HTML:
<div id='acknowledgement'>
	<div class='preamble'>
	  <table class='things-to-know'>
	    <tr>
	      <td>Just checking out</td>
              <td>if it deals with this stuff OK.</td>
	    </tr>
	  </table>
	</div>
	
	<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eleifend adipiscing lacus, in imperdiet urna viverra sed. Nam luctus purus vitae ipsum dignissim cursus. Aliquam orci dui, tristique nec bibendum nec, placerat non elit. Nulla facilisi. Etiam magna justo, sodales non congue vitae, dictum volutpat ligula. Curabitur porttitor condimentum ante, eu tempus mi consectetur sed. Etiam a libero ante. Nullam tempus eleifend tortor, id semper lorem pretium vehicula. Nunc dictum augue vitae leo mollis ac suscipit nisi convallis. Integer pretium sodales sagittis. Duis in iaculis sem. Nam at tortor velit, sed tempus urna. Nulla dolor libero, ullamcorper vel auctor sed, vulputate sed augue. Nulla nec ligula mattis diam semper vulputate. In ante neque, egestas ut viverra eu, aliquet at nunc.</p>

	<p>Vivamus lacus ante, commodo congue ultrices aliquam, suscipit et dolor. Phasellus ac urna metus. Aliquam erat volutpat. Aliquam non turpis tortor. Maecenas malesuada laoreet aliquam. Curabitur at nunc nisl. Maecenas consequat lacinia gravida. Phasellus consectetur odio sit amet massa eleifend ultrices convallis ligula suscipit. Sed dictum, dui vitae molestie placerat, purus mauris placerat eros, eu egestas nulla sapien sed urna. Fusce eget sem lacus, nec facilisis ipsum. Morbi at mi lectus. Vivamus nunc purus, ultricies posuere molestie vitae, placerat non lorem. In urna quam, faucibus id adipiscing rhoncus, sollicitudin sed felis. Aenean tincidunt consectetur consectetur. Cras dignissim commodo quam, in volutpat erat volutpat sed. Pellentesque non eros vitae lacus pulvinar rhoncus non at massa. Quisque sit amet dolor ut metus feugiat mollis id ac mi. Pellentesque mollis leo vitae eros dapibus tincidunt.</p>

	<p>Nulla enim nulla, iaculis sed gravida nec, ullamcorper ac tellus. Cras convallis pulvinar mattis. Maecenas magna odio, hendrerit ac sollicitudin sed, porttitor non orci. Nunc tempus semper sodales. Fusce in purus sem. Sed a felis tellus. Nulla a tortor quis quam ullamcorper porttitor. Vivamus vehicula aliquet magna quis lacinia. Aliquam pellentesque feugiat nibh sit amet gravida. Vivamus quis erat vitae dolor pulvinar consectetur. Etiam vehicula arcu eget mi commodo non blandit ligula volutpat. Sed sapien est, ullamcorper ut rutrum vel, rutrum vitae est. Nam eu enim sit amet metus elementum aliquam at ac neque. Fusce sagittis, quam eu ullamcorper tincidunt, mi orci vehicula velit, in hendrerit elit sem nec neque. Donec quis elit augue. Donec lectus felis, vehicula ut lacinia tempus, vulputate et ligula. Ut lectus nulla, rhoncus sed pretium dignissim, commodo in nisl.</p>
</div>

  1. layout.gif2.8 kB
    A little idea of what I'm trying to accomplish. I'd have multiple signees, anywhere up to four.
mikeday
You could put it in the header of a table, using the <thead> element, which will be repeated at the beginning of each page the table appears on.
chrisdarroch
Thanks mike, that's perfect! :)