Skip to content

Allow page breaks in floats, absolute blocks, table-cells #36

Closed
@Smylers

Description

@Smylers
Contributor

Floated elements that don't fit on the current page simply fall off the bottom, rather than being placed on the next page.

Here's a handy long list of floated elements to demonstrate the problem: http://www.stripey.com/demo/weasyprint/float_off_bottom.html

Look at it in Firefox and do ‘Print Preview’. You should see that there's a page break, with the list being continued on page 2. Similarly if you print from Chromium.

But WeasyPrint generates this file, where the elements simply run off the bottom of the first page: http://www.stripey.com/demo/weasyprint/float_off_bottom.pdf

Activity

SimonSapin

SimonSapin commented on Feb 14, 2013

@SimonSapin
Member

Yes, this is a known limitation: no page breaks are supported inside floats, absolute positioning, or table cells. Unfortunately right now I don’t have a better answer than “avoid using floats that way”.

I’d be happy to help anyone who wants to fix this, but this is a non-trivial change in the layout code. Otherwise this is something to be fixed eventually, but I don’t know when I’ll get to it.

Smylers

Smylers commented on Feb 14, 2013

@Smylers
ContributorAuthor

Thanks. From your description I'm not sure whether this is the known limitation or not.

In this case I'm not trying to have page breaks inside a floated element, but between floated elements. Each li is floated separately. My apologies for not making that clearer in the initial report.

changed the title [-]Floats fall off bottom of page[/-] [+]Allow page breaks in floats, absolute blocks, inline-blocks, table-cells[/+] on Aug 14, 2015
liZe

liZe commented on Oct 28, 2016

@liZe
Member

As reported in #375, we have the same problem with consecutive absolute/relative blocks.

hughsw

hughsw commented on Apr 27, 2017

@hughsw
Contributor

I have just started using WeasyPrint, and I'm already a big fan. However, I have also quickly run into the float/break issue -- my users want Bootstrap and floated columns, and don't like what happens in the PDF document!

Can @SimonSapin or anyone else comment on the refactoring that would be necessary to fix this wartish problem? I haven't perused your codebase yet, but I know Python very well; so, I'm looking for high-level overview of the current layout model/algorithm and why it gets tripped up trying to put breaks in floats, and what would have to be changed.

Thanks,
-Hugh

SimonSapin

SimonSapin commented on Apr 27, 2017

@SimonSapin
Member

301 @liZe

84 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugExisting features not working as expected

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @wd@SimonSapin@Smylers@kleptog@liZe

      Issue actions

        Allow page breaks in floats, absolute blocks, table-cells · Issue #36 · Kozea/WeasyPrint