Forum How do I...?

Struggling to get pagination to work the way I want it to work

ghillerson

I'm building a PDF from HTML pages generated by Jekyll (a static site generator). This has been working well for a couple years; however, I'm trying to figure out how to change pagination:

There are about 160 HTML topic pages in this project, each of which starts with a <section> tag followed by a <H1>. The pages are organized into 6 directories, each of which contains one of the 6 parts of the book.

We've been generating a PDF (which works very well) in which each topic starts on its own page. Now we'd like to only require that the intro page of each part (6 pages) start on a new page, with the other pages flowing together and page breaks happening when they need to.

I plan to change the files so that only those intro pages start with an H1 tag, with all other pages starting with an H2 tag. I know I can add page-break-before: always on the H1's to force the intro pages to start on a new page, but I don't know how to make it so the other pages don't do that.

There are currently not any 'page-break' occurrences in the css. Any help appreciated.
mikeday
Are you currently seeing unexpected page breaks? Is the content in regular blocks or inline-blocks?
jim_albright
What you describe should work. You only break on the one tag. All others should just flow together. Are you experiencing a problem? You may have problems with tables breaking across pages. Hope this works well for you.

Jim Albright
Wycliffe Bible Translators

mikeday
No, it's not tables. To simplify the situation: I have 8 topics: topic1 thru topic8; topic1 and topic5 each start with:

<html>
<head>...</head>
<section>
<div class="topicContent">
<h1>

and topics 2,3,4 and 6,7,8 all start with:

<html>
<head>...</head>
<section>
<div class="topicContent">
<h2>

The "topicContent" div css is empty (it's just a container).

In the PDF, every topic starts on a new page. I'd like only topic1 and topic5 to start on new pages. There are no "page-break" settings in any css in this project. Does Prince automatically generate a page break when it starts processing a new HTML file? If not, I can't figure out what's causing that.

Yes, Prince requires a page break between each new HTML file. In order to flow without page breaks it will be necessary to concatenate the files in some way before converting them to PDF with Prince.