Welcome Guest Search | Active Topics | Sign In | Register

Align html element to bottom of output area Options
nikfe
Posted: Friday, June 26, 2015 9:40:15 AM
Rank: Member
Groups: Member

Joined: 5/25/2015
Posts: 21
Hi

I am creating a document by html and I need to convert it pdf. I need to get html element at bottom of output area but its always at top. This is my most recent try but I have tried a lot more, this also renders correctly divs content at bottom of page on Chrome. Any tips?

Btw sometimes when there is almost enought space to content but just not enought elements are going on top of each others. Is there any way to change output area to only clipping mode? But big question is: how to aling down with html/css or natively with EO.

Quote:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
.table {
display: table;
vertical-align: bottom;
height:100%;
width:100%;
}
.cell {
vertical-align: bottom;
display: table-cell;
height:100%;
width:100%;
}
html, body {
height: 100%;
margin: 0;
}

</style>
</head>
<body>
<div class="table">
<div class="cell">
<table style="margin: 0; padding:0; border-bottom:1pt solid black; background-color:Aqua; width: 100%">
<tr>
<td>Foo</td>
<td style="text-align:right">
Bar
</td>
</tr>
</table>
</div>
</div>
</body>
</html>


eo_support
Posted: Friday, June 26, 2015 12:35:30 PM
Rank: Administration
Groups: Administration

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

You will need to adjust your HTML code in order to achieve this. While user often uses "body { height: 100%; }" in HTML, this won't work with HTML to PDF converter because the converter does not have a "bottom". When a browser displays the HTML on screen, the browser uses the browser window height as the reference height when it evaluate "body { height: 100%; }". However the HTML to PDF converter does not have such a "window" (or you can think that the HTML to PDF has a big window that is just big enough to fit the whole contents). So you can not rely on this. In your case, you can specify a fixed height somewhere (for example, specify a fixed height for the body element) so that a clear reference point can be established and then adjust the rest based on that.

Thanks!
nikfe
Posted: Friday, June 26, 2015 8:00:36 PM
Rank: Member
Groups: Member

Joined: 5/25/2015
Posts: 21
Thanks!

And little bit more information (answer not needed but maybe this is usefull for someone wrestling with same problem).

Btw I forget to tell at first post my full scenario but this wasn't a multi page case. I was rendering a customized header for a single document page and it contains user generated content so content size is pretty dynamic. So at first "set there some fixed height value" seems pretty hacky but I see: since I work on single area I have to of course use my output area height...


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.