Unexpected Page Breaks in PDF


We are using the Jacobs theme and have added some custom CSS. We added a few textboxes and changed the style of some of the headings.

When we export the PDF, there are many page breaks inserted in places we aren’t expecting them. Some page breaks appear after the “header” portion of a textbox that the theme comes with (say, Examples), and some page breaks appear after a custom textbox we have added. There’s more than enough space on the same page for the text to continue after the textbox. However, the text appears on a new page.

What might be the issue, and any ideas as to how we may be able to fix it?

Thank you so much!

If you are using Pressbooks official PDF exporter (PrinceXML) you might be able to use some custom CSS to tell it to not do a page break inside of an element.

The page-break-inside css option has two settings auto and avoid. If you create a custom CSS rule that says, don’t break up a learning objectives box unless you really have to…

<div class="textbox exercises">
<div style="font-weight: 400;">

Lorum Ipsum
<div style="font-weight: 400;">

Then you could create a custom css rule

.exercises {
 page-break-inside: avoid; 

It sounds like you have already created some custom css classes to customize your textboxes, so maybe just add that to your custom CSS? It might force the entire textbox to the next page though since prince seems to think there isn’t enough space.

Thank you for that, @beckej!
I tried that out, and unfortunately, it forced the textbox-header to a new page, and then the textbox-content to the following page. (The textbox content is some cases is longer than a page.)

And I have custom textbooks. In some cases, the regular paragraph text after the box is put on the next page even though there is enough space on the page. This one I don’t understand. Custom textbox for Notes, and there is lots of space left on the page. More text is put on a new page.

Thank you!