Bug 133294 - FILESAVE EPUB Enhancement for styles with page breaks
Summary: FILESAVE EPUB Enhancement for styles with page breaks
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.3.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: EPUB-Export
  Show dependency treegraph
 
Reported: 2020-05-22 20:38 UTC by Dave
Modified: 2020-06-30 15:16 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
File used to reproduce behavior with screenshots of results. (261.69 KB, application/vnd.oasis.opendocument.text)
2020-05-22 20:40 UTC, Dave
Details
PDF export showing what I would expect it to look like. (181.52 KB, application/pdf)
2020-05-22 20:42 UTC, Dave
Details
EPUB export to show how page breaks are ignored. (237.18 KB, application/epub+zip)
2020-05-22 20:43 UTC, Dave
Details
EPUB with stylesheet.css manually modified to correct behavior (237.24 KB, application/epub+zip)
2020-05-22 20:45 UTC, Dave
Details
EPUB using split on pagebreak as suggested. (237.54 KB, application/epub+zip)
2020-05-26 17:31 UTC, Dave
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dave 2020-05-22 20:38:46 UTC
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
Comment 1 Dave 2020-05-22 20:40:13 UTC
Created attachment 161167 [details]
File used to reproduce behavior with screenshots of results.
Comment 2 Dave 2020-05-22 20:42:15 UTC
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.
Comment 3 Dave 2020-05-22 20:43:29 UTC
Created attachment 161169 [details]
EPUB export to show how page breaks are ignored.
Comment 4 Dave 2020-05-22 20:45:49 UTC
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.
Comment 5 Dave 2020-05-23 15:06:43 UTC
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
Comment 6 Dieter 2020-05-26 07:07:54 UTC
I think it works (better), if you choose "Page Break" as splitting method in EPUB Export dialog. Could you please test?
Comment 7 Dave 2020-05-26 17:31:36 UTC
Created attachment 161307 [details]
EPUB using split on pagebreak as suggested.
Comment 8 Dave 2020-05-26 17:48:50 UTC
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.
Comment 9 Dieter 2020-05-26 18:43:49 UTC
(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@@
Comment 10 Dave 2020-05-26 19:01:16 UTC
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.
Comment 11 Heiko Tietze 2020-05-27 15:46:32 UTC
(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?
Comment 12 Dave 2020-05-27 16:22:49 UTC
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.
Comment 13 BogdanB 2020-05-27 18:37:15 UTC
I tested all combination for this example.
heading - fixed -> ok
heading - reflowable -> not ok
page break - fixed -> ok
page break - reflowable -> ok
Comment 14 Miklos Vajna 2020-05-28 07:19:57 UTC
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. :-)
Comment 15 Heiko Tietze 2020-06-30 15:16:45 UTC
(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.