danfickle / danfickle/openhtmltopdf

Display element with named page on same page as content before

Open
#775 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

I would like to display a custom header if the element with class `.box` is on the current page. When I set the page CSS-attribute to `.box`, then it will be always placed on a new page, but I want it on the old page, if enough space is available. I didn't set `page-break-before: always;`. Is this a bug or should I go another way?

```html

@page defined-page {
@top-center {
content: 'This page was defined';
}
}
/*the box should display on the same page as the content before, if enough space is available*/
.box {
page-break-inside: avoid;
page: defined-page;
width: 100mm;
height: 100mm;
background-color: red;
}


Content before
Content before
Content before
Content before

test

```
Reproducable on online sandbox

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.