Welcome Guest Search | Active Topics | Sign In | Register

HtmlToPdf Table Height/Width in % Options
Pingouf
Posted: Friday, December 9, 2016 6:30:47 AM
Rank: Newbie
Groups: Member

Joined: 12/9/2016
Posts: 2
Hello,

How can i make a table with height and width in % ?

I have try this :

<div style="width: 600px; page-break-after: always; page-break-before: always; page-break-inside: avoid;overflow:hidden;">
<table width="100%" height="800px" border="1" cellpadding="0" cellspacing="0" style="display: block;overflow:hidden;" bgcolor="black">
<tbody width="100%" height="800px" style="display: block;">

<!-- Ligne 1 -->
<tr bgcolor="yellow" width="100%" height="16.66%" style="display: block; position: relative; overflow: hidden;">
<td width="25%" bgcolor="red" height="100%" style="/*padding-top: 10px; */display: block; position: relative; float: left; box-sizing: border-box; overflow: hidden; vertical-align: top;">
<span>tfsdd</span>
</td>

<td width="25%" bgcolor="grey" height="100%" style="/*padding-top: 10px; */display: block; position: relative; float: left; box-sizing: border-box; overflow: hidden; vertical-align: top;">
<span>tfds</span>
</td>
<td width="25%" bgcolor="red" height="100%" style="/*padding-top: 10px; */display: block; position: relative; float: left; box-sizing: border-box; overflow: hidden; vertical-align: top;">
<span>t</span>
</td>

<td width="25%" bgcolor="grey" height="100%" style="/*padding-top: 10px; */display: block; position: relative; float: left; box-sizing: border-box; overflow: hidden; vertical-align: top;">
<span>tfdss</span>
</td>
</tr>
</tbody>
</table>
</div>

Thanx,

Didier.
eo_support
Posted: Friday, December 9, 2016 8:09:19 AM
Rank: Administration
Groups: Administration

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

If you are using HTML to PDF, then you can not have 100% height. The reason is the HTML to PDF converter will try to automatically detect your page height (so that it can determine how many pages the PDF file needs to be). This is exactly the opposite of how 100% height works --- in that case you have the browser window's height fixed first, then adjust the contents to fit the window. Fixing browser window height works fine on screen because it can add scroll bars. The HTML to PDF converter can not add scrollbars in the final output. So it must resize its "window" to fit the contents. If at the same time your contents resize to fit the "window", then it will create a dependency loop. So this will not work. You will have to change your HTML to avoid this.

One simple way to create full page content is to use the auto scale feature:

https://www.essentialobjects.com/doc/pdf/htmltopdf/auto_fit.aspx#autofit

If you set both AutoFitX and AutoFitY to ScaleToFit, then the converter will automatically scale the output to fit into a single page. That will achieve similar result as 100% height.

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.