openhtmltopdf icon indicating copy to clipboard operation
openhtmltopdf copied to clipboard

Bug on text inside table when using margin-left

Open lagar84 opened this issue 2 years ago • 1 comments

Hello,

I found an issue when using margin-left on table.

Reproducer:

<html>
<head>
<style>
@page {
	size: 200px 250px;
	margin: 10px 10px 10px 10px;
}
html {
    font-family: sans-serif;
    font-size: 14px;
    margin: 0;
    padding: 0;
}
body {
  margin: 0;
  padding: 0;
}
</style>
</head>
<body>
      With margin-left on table
    <table style="width: 100%; margin-left: 15px; border: 0;">
        <tr>
            <td style="width: 60px;">Label:</td>
            <td>a a a a a a a a a a a a a a a a a a a a a a</td>
        </tr>
    </table>
<br/><br/>
      Without margin-left on table
    <table style="width: 100%; border: 0;">
        <tr>
            <td style="width: 11px;"></td> <!-- workaround using empty cell -->
            <td style="width: 60px;">Label:</td>
            <td>a a a a a a a a a a a a a a a a a a a a a a</td>
        </tr>
    </table>
</body>
</html>

This results in the pdf below (using sandbox or on my local project using version 1.0.10):

image

I could workaround the problem by not using margin-left, and instead I used an empty cell.

However, it doesnt hurt to report the issue.

Thanks for this great library. Hope you can continue this great work.

Best wishes, lagar84.

lagar84 avatar Jul 28 '22 19:07 lagar84

PR #876

lagar84 avatar Oct 19 '22 17:10 lagar84