danfickle / danfickle/openhtmltopdf

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

Open
#948 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

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:

```



@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;
}


```

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.