openhtmltopdf icon indicating copy to clipboard operation
openhtmltopdf copied to clipboard

Display inline-block works unexpected

Open mndzielski opened this issue 3 years ago • 3 comments

Hi,

I've discovered that css display inline-block breaks test befere last word.

Code example:

<html>
<head>
</head>
<body>
<div style="display: inline-block;">
  aaaaa bbbbb cccc dddd eeeee
</div>
</body>
</html>

Pdf result: image

Browser result:

image

mndzielski avatar Dec 11 '21 18:12 mndzielski

Somehow after hours of debugging, if I comment this line it works well; https://github.com/danfickle/openhtmltopdf/blob/open-dev-v1/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/BlockBox.java#L2081

I will inspect futher.

mndzielski avatar Dec 12 '21 01:12 mndzielski

What is quite strange its seems to have "display inline" value.

image

mndzielski avatar Dec 12 '21 01:12 mndzielski

I am experiencing the same problem with inline-block-tables. I am using openhtmltopdf to convert E-Mails into PDFs, in some cases I have HTML like:

<table>
  <tr>
    <td>
      <table style="display: inline-block;width:345px">...</table>
      <table style="display: inline-block;width:35px">...</table>
      <table style="display: inline-block;width:315px">...</table>
    </td>
  </tr>
</table>

Each table gets rendered into a separate row instead of a single one which malforms the whole HTML-structure.

sm3sher avatar Dec 17 '21 12:12 sm3sher