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

"html" element viewport width not adjusted when pagesize is set to landscape in a named @page (unnamed works ok) #948

Open
florimon opened this issue Oct 11, 2023 · 3 comments

Comments

@florimon
Copy link

Hi, first of all thanks for creating an amazing utility.

I ran into the following issue though, here is my 'testcase' html in condensed form:

<html lang="en" class="landscape">
    <head>
        <style>
            @page portrait {
                size: a4 portrait;
            }
            @page landscape {
                size: a4 landscape;
                border: 5px solid red;
            }
            html.portrait {
                page: portrait;
            }
            html.landscape {
                page: landscape;
            }
            html {
                height: 100%;
                border: 5px solid green;
            }
        </style>
    </head>
    <body></body>
</html>

By putting a 'landscape' CSS class on the "html" element, the "@page landscape" rule is activated, which is evidenced by the produced PDF being in landscape mode, and the page having a thick red border box.
Inside this red box however is a much narrower green box around the "html" element - I would have expected this to align on all sides to the red box instead. When you change the "@page landscape" selector to just "@page", the green box does indeed have the same width as the red box.

@lindamarieb
Copy link

I'm experiencing the same. Is there a solution for this?

@siegelzc
Copy link

Why not just apply the styles to the body element? Is there a reason why that doesn't work?

@lindamarieb
Copy link

lindamarieb commented Mar 15, 2024 via email

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

No branches or pull requests

3 participants