Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug on text inside table when using margin-left #857

Open
lagar84 opened this issue Jul 28, 2022 · 1 comment
Open

Bug on text inside table when using margin-left #857

lagar84 opened this issue Jul 28, 2022 · 1 comment

Comments

@lagar84
Copy link

lagar84 commented Jul 28, 2022

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 added a commit to lagar84/openhtmltopdf that referenced this issue Oct 19, 2022
excludes margins from table width calculation
@lagar84
Copy link
Author

lagar84 commented Oct 19, 2022

PR #876

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant