When a forced page break (`break-before: page` or `page-break-before: always`) occurs inside an
element that has `padding-top` and `border-top`, Prince re-applies that leading edge on **every**
subsequent page fragment, not just once at the real start of the box.
In production we use this for letters. On the first page there are address blocks (position: absolute) who are visible through the letter-window. After this the flowing content should begin (multiple pages). This works fine as long as there is no forced page break inside of the flowing content.
Files
* repro-forced-break.html — forced break, incorrect
* control-natural-break.html — same file without `break-before`, correct
They differ only in the `style="break-before: page"` attribute.
Environment
Prince 16.2, Linux.
prince repro-forced-break.html -o repro-forced-break.pdf
prince control-natural-break.html -o control-natural-break.pdf
Observed
Page area starts at 20mm. `.wrapper` has `padding-top: 40mm`, so the first
line of the first fragment is expected at 60mm, and at 20mm on all later fragments.
In control this works properly:
page 1: content begins at 60mm
page 2: content begins at 20mm
page 3: content begins at 20mm
With the forced break the first line of every page starts at 60mm from top. Additionally, the borders of the wrapper are repeated.
Note that page 3 of the repro is reached by an unforced break, yet it still gets a leading edge:
once a forced break has occurred inside the box, every following fragment is affected.
Expected
Pages 2..n of repro-forced-break.pdf should look like pages 2..n of control-natural-break.pdf:
no `padding-top`, no `border-top`, first line at 20mm.
Notes
element that has `padding-top` and `border-top`, Prince re-applies that leading edge on **every**
subsequent page fragment, not just once at the real start of the box.
In production we use this for letters. On the first page there are address blocks (position: absolute) who are visible through the letter-window. After this the flowing content should begin (multiple pages). This works fine as long as there is no forced page break inside of the flowing content.
Files
* repro-forced-break.html — forced break, incorrect
* control-natural-break.html — same file without `break-before`, correct
They differ only in the `style="break-before: page"` attribute.
Environment
Prince 16.2, Linux.
prince repro-forced-break.html -o repro-forced-break.pdf
prince control-natural-break.html -o control-natural-break.pdf
Observed
Page area starts at 20mm. `.wrapper` has `padding-top: 40mm`, so the first
line of the first fragment is expected at 60mm, and at 20mm on all later fragments.
In control this works properly:
page 1: content begins at 60mm
page 2: content begins at 20mm
page 3: content begins at 20mm
With the forced break the first line of every page starts at 60mm from top. Additionally, the borders of the wrapper are repeated.
Note that page 3 of the repro is reached by an unforced break, yet it still gets a leading edge:
once a forced break has occurred inside the box, every following fragment is affected.
Expected
Pages 2..n of repro-forced-break.pdf should look like pages 2..n of control-natural-break.pdf:
no `padding-top`, no `border-top`, first line at 20mm.
Notes
- `page-break-before: always` behaves identically to `break-before: page`.
- Setting `box-decoration-break: slice` or `clone` explicitly makes no difference.
- Using a named page (`page: foo`) to force the break shows the same behaviour.
- Putting the padding on `body` instead of a `div` shows the same behaviour.
- `margin-top` on the ancestor is affected in the same way as `padding-top`.
