3

I have a generated 100 pages long document with dozens of sections, headers and varying text + image content. There are user inserted pagebreaks as well as injected pagebreaks, but most of the text runs from page to page.

Something that is driving me crazy is that I cannot detect if an element is the first or the last on the page.

For example my text-container div has bottom and top margin of 10 mm. If pagebreak happens just before it, it should have 0 top margin. But since I have no way of detecting Prince automated pagebreaks, text-containers have 10mm extra top margin on some pages.

(this is an example only, the real situation is a little more complex)

Is there ANY way to detect what Prince is doing to flowing content?

  • After further investigation I found this thread about margin collapsing at top of the page http://www.princexml.com/bb/viewtopic.php?f=4&t=2438. It didn't help much since in my case top margin should be 0 after user defined pagebreaks as well. – user2012015 Jan 25 '13 at 22:51
  • How are you defining your page breaks? `page-break-before: always`? If so couldn't you add `margin-top: 0 !important` to those same elements? – tuespetre Jul 07 '13 at 06:24
  • Sorry, just saw how old this is... – tuespetre Jul 07 '13 at 06:25

1 Answers1

1

First you need to set the Page height, unless your text will go out from the page. and after set page-break-after: always in page container class. then it will works.

Ashish Panwar
  • 1,118
  • 3
  • 11
  • 18