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

Page margins being ignored when using a single flexbox column #2066

Open
ezarowny opened this issue Feb 12, 2024 · 0 comments
Open

Page margins being ignored when using a single flexbox column #2066

ezarowny opened this issue Feb 12, 2024 · 0 comments
Labels
bug Existing features not working as expected

Comments

@ezarowny
Copy link

ezarowny commented Feb 12, 2024

I'm using WeasyPrint 61.0 and I have a page structure like this:

<!doctype html>
<html>
  <head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <style>
      @page {
        margin-bottom: 22px;
        margin-left: 15px;
        margin-right: 15px;
        margin-top: 20px;
        size: letter;
      }

      body {
        display: flex;
        flex-direction: column;
      }

      .outer-container {
        border-color: #7F465C;
        border-style: solid;
        border-width: 0 2px 2px;
        height: 100%;
      }
    </style>
  </head>

  <body>
    <div class="outer-container">
      <div class="letter-body">
        <div class="letter-header">...</div>
        <div class="letter-header-img-container">...</div>
        <div class="letter-name">...</div>
        <div class="lots-of-text">...</div>
      </div>
    </div>
  </body>
</html>

I'm attempting to make the page content fill up the entirety of the last page of the document so the border of outer-container will be at the bottom of the last page instead of where the content ends. For some reason, it seems that the left and right borders always run to the bottom of the page on all pages except the last and completely ignores my page margins:

Screenshot 2024-02-12 at 12 31 12 PM

I ran into this problem when upgrading from v60.2 because my original implementation only renders the first page on v61.0 and nothing else. I think my original implementation was kind of a hack because I was applying CSS to the html element, but here it is for reference:

    html {
      height: 100%;
    }

    body {
      height: 100%;
    }

Which produced this on v60.2:

Screenshot 2024-02-12 at 12 36 09 PM

The last page of the document of my v61.0 implementation looks just like the above image so maybe page margins are only being applied against the entirely of the document instead of individual pages?

@liZe liZe added the bug Existing features not working as expected label Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing features not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants