Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement -fs-page-break-min-height #31

Merged
merged 2 commits into from
Jul 15, 2016

Conversation

rototor
Copy link
Contributor

@rototor rototor commented Jul 13, 2016

This CSS property allows to force a page break before an element if not the specified space is left on the
current page.

CSS orphans and page-break-inside:avoid are nice, but dont work always,
especially with complex tables.

This CSS property allows to workaround many page break problems.

Also adds a sample document which demonstrates the effect of
this property. Also the TestcaseRunner now prints onto the System.out
were the output PDF was written.

@danfickle I'm not sure if -fs-page-break-min-height is the best name for this property. If you can come up with some better name, I'll change it.

Yes, this is some kind of "workaround" hack. But I "need" openhtmltopdf work for me now, as I want to redo some complex JasperReports reports with FreeMarker + openhtmltopdf. Of course it would be better to just fix the layout bugs, but as seen in #19 its not that easy :(

If you want to see what bugs I mean => just comment out the CSS properties in FSPageBreakMinHeightSample.html:176 and FSPageBreakMinHeightSample.html:173 and run the TestcaseRunner.

a page break before an element if not the specified space is left on the
current page.

CSS orphans and page-break-inside:avoid are nice, but dont work always,
especially with complex tables.

This CSS property allows to workaround many page break problems.

Also adds a sample document which demonstrates the effect of
this property. Also the TestcaseRunner now prints onto the System.out
were the output PDF was written.
@danfickle
Copy link
Owner

Thanks @rototor - The code looks good - The only queries I have are:

  • I don't think this property should be inherited. Layout properties generally are not.
  • Is it possible to make a simpler test case that just demonstrates this property?
  • What happens if the figure provided is greater than the page height?

If you like I can take care of these minor concerns after the merge. Let me know if that is alright. Thanks again and sorry for the delay, I've had a cold.

@rototor
Copy link
Contributor Author

rototor commented Jul 15, 2016

@danfickle to be honest, I just copied the CSS declaration and did not really care about the inherited specification. I think you are right that this property should really not be inherited.

The last point should not matter, as -fs-page-break-min-height is more or less nothing else than a "page-break-before:conditional". I.e. it only affects places were a page-break-before could cause a page break. So it would just add an other page break. But I have not tested this yet.

If you want to do this little changes, feel free to do so. I wont have time the next 4 days.

@danfickle
Copy link
Owner

OK, thanks a lot @rototor

@danfickle danfickle merged commit 18520bf into danfickle:open-dev-v1 Jul 15, 2016
@rototor rototor deleted the fs-pagebreak-min-height branch July 15, 2016 11:16
@rototor rototor mentioned this pull request May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants