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

Weasyprint 46 handles wrongly top-margin on H1 #835

Closed
knyttl opened this Issue Mar 27, 2019 · 4 comments

Comments

2 participants
@knyttl
Copy link

knyttl commented Mar 27, 2019

Consider this document:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <style type="text/css">
        @page{size:69mm 146mm;margin:0;padding:0}
        body,html{margin:0;padding:0;height:100%;}
        body *,html *{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}
        h1 {
            margin-top: 9mm;
            margin-bottom: 3.5mm;
            padding-top: 0;
        }
        .page{page-break-after:always;position:relative;height:100%;padding:8mm 5mm 5mm 5mm}</style>
</head>
<body>
    <div class="page">
        <h1 style="background-color: #f00;">
            Respect festival 2019
        </h1>
    </div>

    <div class="page">
        <h1 style="background-color: #f00;">
            Respect festival 2019
        </h1>
    </div>

    <div class="page">
        <h1 style="background-color: #f00;">
            Respect festival 2019
        </h1>
    </div>
</body>
</html>

There are three equal pages, however the only two has correct top margin. It worked correctly with version 0.42.3. See attached PDF.

ticket.pdf

@liZe liZe closed this in ee69b32 Mar 27, 2019

@liZe

This comment has been minimized.

Copy link
Member

liZe commented Mar 27, 2019

Thank you.

Oops, there was a problem in the way margin-break: auto was handled. Top margins are discarded when an unforced page break happens, but it is kept with forced page breaks (as it is in your document).

@liZe liZe added this to the 47 milestone Mar 27, 2019

@liZe liZe added the conformance label Mar 27, 2019

@knyttl

This comment has been minimized.

Copy link
Author

knyttl commented Mar 27, 2019

Wow. You fixed the issue an hour after my report? Just wow. When will you release it?

@liZe

This comment has been minimized.

Copy link
Member

liZe commented Mar 27, 2019

Wow. You fixed the issue an hour after my report? Just wow.

😄

When will you release it?

Probably not before a couple of weeks. Before that, you can use margin-break: keep as a workaround, or install the current master branch with pip install git+https://github.com/Kozea/WeasyPrint.git.

@knyttl

This comment has been minimized.

Copy link
Author

knyttl commented Mar 27, 2019

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.