Welcome Guest Search | Active Topics | Sign In | Register

PDF: Body height is ignored Options
nikfe
Posted: Monday, October 31, 2016 5:19:52 AM
Rank: Member
Groups: Member

Joined: 5/25/2015
Posts: 21
Hi

I found minor deprecation: height of body is ignored. Body height work fine in 16.1.*. Issue is trivial to work around so our perspective this is just FYI / fix if this was unexpected behaviour.

Quote:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello World</title>
<style>
body {
background-color: #CFC;
height: 1500px;
}
</style>
</head>
<body>
<h1>Hello World</h1>
<p>This is test</p>
</body>
</html>
eo_support
Posted: Monday, October 31, 2016 12:22:17 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

The height value on the body element is always ignored because the HTML converter must automatically detects the page size. For a regular browser window, the body element is almost always the same as the browser window. For example, if you reduce the height from 1500px to 100px and load the page in a browser, the entire browser window will be filled with the background color, NOT just the top 100px. In this case, the browser determine the body element's size based on the known window size.

The HTML to PDF converter on the other hand, does not have a known window size in advance since in a PDF file all page contents must be rendered instead of just rendering a portion of it and then add a scroll bar. As such it will automatically adjust "window" size based on contents size. In order to do so it must ignore size settings on the body element.

To work around the problem, you can move the height setting into a DIV inside the body element. Then it will be properly honored.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.