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

Long elements getting pushed to next page when using top & bottom margin and font #860

Closed
vollkorn1982 opened this issue May 6, 2019 · 1 comment

Comments

2 participants
@vollkorn1982
Copy link

commented May 6, 2019

I built a letter template which works fine on weasyprint 45, but breaks on versions 46 and 47. The reduced, minimal example is this HTML file:

<!DOCTYPE html>
<head>
    <style>
	@page {
		margin-bottom: 40mm;
		margin-top: 20mm;
	}

	.content {
		margin-top: 78.46mm;
	}

	.content pre {
		font-size: 8pt;
	}
    </style>
</head>

<body>
    <div>
		<div class="content">
            <p>
                A short paragraph
            </p>

            <pre>
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
			very long wall of text
            </pre>
        </div>
    </div>
</body>
</html>

With weasyprint 45 (test_45.pdf) it looks as I expect it and a page break splits the very long wall of text on page 1 and 2. But on weasyprint 46 (test_46.pdf) and 47 (test_47.pdf) this does not happen.

If I remove just any of the margin-* or font elements, the paragraph is again being split as expected.

@liZe

This comment has been minimized.

Copy link
Member

commented May 15, 2019

Thank you for reporting this issue.

Believe it or not, it's actually a duplicate of #851.

@liZe liZe closed this May 15, 2019

@liZe liZe added this to the 48 milestone May 15, 2019

liZe added a commit that referenced this issue May 15, 2019

Don't change position of block children to avoid rounded float error
To fix #860 and #851, we decided to move block children a little bit to keep
them in the page. It's a bad idea, because children position is altered (and it
breaks many tests, by the way).

Increasing the allowed max_position_y is a better workaround as it doesn't
move blocks.
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.