When using aspose-words version 21.5, some style conversion issues occurred when converting from html to pdf:
Question 1:
It can be aligned in HTML, but the format is not aligned after converting to PDF
Question 2:
After converting to PDF, the width and height of the table are inconsistent with the width and height displayed in HTML7b54f5ab356222fe87eebf8544a9727.png (252.7 KB)
6880a546fb4e0a5652e1525fa3b3347.png (156.1 KB)源文件.zip (55.4 KB)
@mm1996 Could you please attach your input HTML and output PDF documents here for testing? We will check the issue and provide you more information.
@mm1996 Thank you for additional information.
-
Table row height seems to be correct to me. When I open your HTML in the browser I see the same height as in PDF produced by Aspose.Words.
-
I have managed to reproduce the problem with checkbox alignment. The problem has been logged as WORDSNET-23599. We will keep you informed and let you know once it is resolved or we have more information.
Thank you very much for your reply:
During the test, it was also found that some tables could maintain the original width and height, but some tables could not
6d8e3c914ac9ef794972266e1fef7d6.png (289.1 KB)
20220317105751_195350.zip (60.1 KB)
@mm1996 It is quite difficult and sometimes impossible to retain the original HTML formatting in MS Word documents. In your document I see that units are mixed some dimensions are specified in pixels some in points (height: 133.5pt; width: 35px;
). Also some dimensions are duplicated in attributes and in styles with different values. For example:
<table height="206" style="margin-right: auto; margin-left: auto; border: 0.75pt solid rgb(0, 0, 0); border-collapse: collapse; border-spacing: 0px; background-color: rgba(0, 0, 0, 0); height: 254px; width: 686px;" width="" tableid="d0742f35-93bd-2ca6-6a37-a5bd57f42649">
height="206"
and height: 254px;
in style attribute. These inconsistency might cause different viewer or rendering apps handle content differently.
The issues you have found earlier (filed as WORDSNET-23599) have been fixed in this Aspose.Words for Java 22.7 update also available on Maven.