Issue with CSS

Hi,

I’m move this post from the section Aspose.PDF because i’ve the aspose.word license.

I’m trying to convert an HTML string to Pdf, and I’m facing the following issue: the CSS width property is apparentely ignored, at least on divs and tables.
I tried using both px values and percent values, but to no avail.

Here some simple examples I tried that work on an HTML page and don’t when converted to PDF (omitting the html and body tags):
<div>
    <div style=display: inline-block; width: 250px;>aa</div>
<div style=display: inline-block; width: 250px;>bb</div>
</div>
<div>
<div style=display: inline-block; width: 33%;>aa</div>
<div style=display: inline-block; width: 33%;>bb</div>
</div>
<div style=width: 100%> 
<div style=display: inline-block; width: 33%;>aa</div>
<div style=display: inline-block; width: 33%;>bb</div>
</div>
As I already said, same goes for tables. I’m actually using aspose.word 16.8.0.
I tried this code, but the output was even so wrong styled.
HtmlLoadOptions htmloptions = new HtmlLoadOptions();
// Load HTML file
Document doc = new Document("/Users/fahadadeel/Downloads/resources/input.html", htmloptions);
// Save HTML file
doc.save("/Users/fahadadeel/Downloads/resources/output.pdf");
I’m doing something wrong?
Thanks.
Hi Riccardo,

Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of any correction, we have logged this problem in our issue tracking system as WORDSNET-14834. Our product team will further look into the details of this problem and we will keep you updated on the status of this issue. We apologize for your inconvenience.

Best regards,

Hi,

is there any news?

Regards Riccardo

Hi Riccardo,


Thanks for being patient.

Unfortunately, your issue is not resolved yet. Our product team has completed the analysis and the root cause of this issue has been identified. Elements with ‘display: inline-block’ are not currently supported, because there is no counterpart for them in the Aspose.Words’ DOM. As a result, we currently import such elements as ‘inline’ and are unable to preserve their size.

I am afraid, the implementation of the fix of this issue has been postponed for now (no ETA is available). We need to investigate the best possible way to preserve size of ‘inline-block’. We will inform you via this thread as soon as this issue is resolved. We apologize for your inconvenience.

Best regards,