Description: I have been using LibreOffice Writer's export to EPUB feature to create ebooks. It works very well, but could be made better with better handling of Writer's "Page Break Before" style. Currently, the EPUB generated by Writer does not take these breaks into account, making the output less attractive than the native ODF or exported PDF. But, by manually modifying stylesheet.css, in the EPUB format, I was able to produce the page break before behavior correctly. I would like to request an enhancement to have the Export to EPUB do this by default. I am uploading a Writer document that explains this request in more detail, as well as PDF and EPUB documents produced in Writer 6.4.3.2. A second EPUB document has the modifications I made to have it display stylings that are more in line with the native ODF and exported PDF. All of my tests and screenshots are with Writer on Windows 10 64-bit and using Kindle Previewer 3 as the ebook reader. Thanks for a wonderful product and the recent addition of EPUB exports. Steps to Reproduce: 1. Create a document and modify a style to include page break before. 2. Export to EPUB and PDF. 3. Compare the placement of the styled text and notice EPUB does not include the break like ODF and PDF do. Actual Results: EPUB ignores page breaks in styles. Expected Results: EPUB should render page breaks just like the ODF and PDF formats. Reproducible: Always User Profile Reset: No Additional Info: In the attached ODF document, I have shown how it is possible to add CSS parameters in the EPUB's stylesheet.css that will make EPUBs render more like the ODF and PDF versions of the same file
Created attachment 161167 [details] File used to reproduce behavior with screenshots of results.
Created attachment 161168 [details] PDF export showing what I would expect it to look like. The PDF is only included for comparison to the EPUB. PDF renders exactly as expected.
Created attachment 161169 [details] EPUB export to show how page breaks are ignored.
Created attachment 161170 [details] EPUB with stylesheet.css manually modified to correct behavior This EPUB export was unzipped and had lines added to stylesheet.css. There is a screenshot and explanation of the modifications in the example document.
I did some more digging into the EPUB 3.0 specification and related samples.[1] It seems they use the older page-break-before and page-break-after CSS parameters. Though, break-before and break-after worked in my experimentation and "break" seems to have replaced "page-break" in the CSS docs I consulted.[2] References: [1] https://github.com/IDPF/epub3-samples/blob/master/30/childrens-literature/EPUB/css/epub.css [2] https://developer.mozilla.org/en-US/docs/Web/CSS/page-break-before
I think it works (better), if you choose "Page Break" as splitting method in EPUB Export dialog. Could you please test?
Created attachment 161307 [details] EPUB using split on pagebreak as suggested.
Using split on pagebreak instead of split on header makes the output look exactly like I would expect. Thank you for that suggestion. However, I would consider this a workaround and would still like to request the enhancement. My reasoning is this: 1) As an ebook author, I should not need to concern myself with the internals of the EPUB format to the point of knowing how it divides up the XHTML files inside the archive. It's not intuitive. 2) page-break-after: always; and page-break-before: always; are fully supported in the EPUB 3 specification. Why not map Writer's break before/after style options to those directly? I think of it like this: I have a line of text, "Section Title", that I've styled as a title in Writer. The EPUB xhtml should have something like <span class="title">Section Title</span> The EPBU css should contain "title { page-break-before: always; }", if I've specified a break after in Writer, along with any other corresponding styling I've used when modifying the style. Thanks again for maintaining such a wonderful open source product and for giving me a workaround to my current dilemma. Your time and effort is much appreciated.
(In reply to Dave from comment #8) > Using split on pagebreak instead of split on header makes the output look > exactly like I would expect. Thank you for that suggestion. > > However, I would consider this a workaround and would still like to request > the enhancement. After reading infos from LO help [1], I would disagree, because others perhaps prefer split after heading. But I'm not familiar with that topic, so let's ask design team for input and decision [1] https://help.libreoffice.org/7.0/en-GB/text/shared/01/ref_epub_export.html?System=WIN&DbPAR=WRITER&HID=writerperfect/ui/exportepub/dialog-action_area1#bm_@@nowidget@@
I agree that splitting on heading is most logical, and it works fine for most of the document. The problem I run into is when I try to make Title styling show the title of an ebook on a separate page. Just to clarify... I do this: Right-click Title styling and choose Modify. Enter 3.0" Spacing Above Paragraph on the Indents & Spacing tab. Check Insert Break, type: Page, Position: After from the Text Flow tab. This gives me a title page where the title stands on its own, pushed toward the vertical center of my page. No other text flows onto the page. It outputs this way for ODF, and PDF (probably others as well) but EPUB ignores the "Insert Break, type: Page, Position: After" from the Text Flow tab. To me, they should all look the same, and I can achieve that by manually adding page-break-after: always; in the right place in stylesheet.css. That's the reason for my enhancement request.
(In reply to Dieter from comment #9) > others perhaps prefer split after heading. Hard to imagine the use case where a heading is followed by a page break. Title/subtitle - true, but not ordinary outlines. Miklos, what do you think about the request?
I also doubt that a heading would be followed by a page break. But, the Writer styles allow break before and break after. And, there is a one-to-one relationship between Writer's break before/after and EPUB's page-break-before/after: always; Since it's such a direct match, it seems like it would be trivial to add both cases rather than trying to guess what users are going to try.
I tested all combination for this example. heading - fixed -> ok heading - reflowable -> not ok page break - fixed -> ok page break - reflowable -> ok
If the epub export currently ignores this formatting, then handling it in some way is a fair enough request. Even if "page break" is a bit odd in the context of reflowable HTML. :-)
(In reply to Miklos Vajna from comment #14) > If the epub export currently ignores this formatting, then handling it in > some way is a fair enough request. Even if "page break" is a bit odd in the > context of reflowable HTML. :-) So let's take this as a qualified enhancement request.