Forum Bugs

"break-before: right" on a right page creates two blank pages

ats
I think "break-before: right" has a glitch in the context of multiple
HTML files collated into one PDF file:

"right" is supposed to ensure that, e.g., a chapter starts on a right-
hand page and you generate one or two page breaks for that
purpose. Two page breaks should result in one blank page, enough
to fudge a chapter which has an odd number of pages.

This works as advertised in a single HTML document. However, it
looks to me as if you are implicitly generating a page break when a
new HTML document starts. At this point you are on a new page.
The chapter title would have a "break-before: right" and if the
current new page is already an odd (right) page, you generate two(!)
blank pages rather than none.
howcome
Here's a simple attempt to replicate the problem you describe.
prince one.html two.html -o foo.pdf

However, the resulting pdf file only has one blank page, which seems correct.

If you still see a problem, could you post source files?
  1. foo.pdf20.7 kB
  2. one.html0.3 kB
  3. two.html0.2 kB

Edited by howcome

ats
Unfortunately, it's more complicated. I cannot produce a "small" example.

I'm using JSDOC to produce JavaScript module documentation plus tutorials and I'm trying to print the tutorials as PDF chapters (250+ pages). A command like

prince -s prt-style.css tutorial*.html -o bad.pdf

produces two blank pages between some chapters where there should be none. Other than that the result is great, but the blank pages still contribute to page numbering.

I found a workaround: The tutorials contain JSDOC-related navigation bars and footers, etc. If I remove all this and just string the tutorial <section> parts together into a single document, formatting that works but for the occasional page showing up in landscape orientation.

I'll enclose the prt-style.css file, but the JSDOC stuff would be rather voluminous.
  1. prt-style.css2.0 kB
howcome
Could there be some some invisible content on the first of the two "blank" pages?
ats
There pretty much has to be -- but it's "invisible" -- I can't see it in PDF. In HTML there's obviously tons, all the navigation stuff that JSDOC creates, some of it with JavaScript. The stylesheet prt-style.css uses display:none to make that stuff go away. Extracting and collating just the <section> part of the tutorials definitely eradicates the extra stuff.

You can look at everything at <schreiner-family.net/toys/EBNF/> -- the first two icons next to "Tutorials" lead to the HTML and PDF versions -- first chapter in HTML, all of it in PDF. The PDF version is the result of collating into a single HTML file before applying prince.

The point is to use one source for different use cases -- online and print, i.e., modifying the source for the benefit of print is not really an option, extracting (in this case with an awk program) is. The source itself is very much preprocessed, e.g., Markdown for text, extracts from live sources, etc.
howcome
You could try using the boxtracking API to list elements appearing on a certain page. Here's a simple example which detects elements on page two (and color them red):

https://css4.pub/2023/boxtracking/#color-me-red-but-only-on-page-2-please

Edited by howcome