HTML to PDF conversion losing formatting

When converting a html file to pdf with Aspose Words, the images with

style="display:block; margin-left: auto; margin-right: auto;

aren’t getting centralized.

For example the html below:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body class="mce-content-body">
<p><img style="display:block; margin-left: auto; margin-right: auto;" src="any image" alt=""></p>
</body>
</html>

Is there a workaround? I tried convert with the last version in Aspose website, but it didn’t work also.

@ipm.aspose Please note, Aspose.Words is designed to work with MS Word documents. HTML documents and MS Word documents object models are quite different and it is not always possible to provide 100% fidelity after conversion one format to another. In most cases Aspose.Words mimics MS Word behavior when work with HTML.
As I can see output PDF produced from your HTML using Aspose.Words and MS Word look the same:
Aspose.Words: out.pdf (5.5 KB)
MS Word: ms.pdf (11.9 KB)

But is there a way to workaround this with Aspose Words? I should be able to center the img with these styles…

@ipm.aspose You can specify center paragraph alignment:

<html>
<body>
    <p style="text-align:center"><img src="some image" alt=""></p>
</body>
</html>

Yes, but I have an internal editor that can create a <p- aligned to left, with an img inside it aligned at center. In my editor, everything is ok, but when it gets converted, it became unformatted.

@ipm.aspose As I have mentioned, unfortunately, HTML and MS Word document object models are quite different and it is impossible to provide 100% fidelity after conversion from HTML to Word (or PDF as in your case) using Aspose.Words.
You can consider using Aspose.Html, which is designed to work with HTML document and provides HTML to PDF conversion capability.