HTML converted to PDF presented data not as expected

Hi working with Aspose.Words to convert HTML to PDFm and it working well, but now customer sent to us new HTML document and it the styles and html tag presented not expected, wrong alignment, sizing and position

The code that we are using is:

string workingDirectory = Directory.GetCurrentDirectory();

string newWorkingDirectory = Path.GetDirectoryName(Environment.ExpandEnvironmentVariables(this.TemplateFileName));
if (Directory.Exists(newWorkingDirectory))
    Directory.SetCurrentDirectory(Environment.ExpandEnvironmentVariables(newWorkingDirectory));

Document htmlDocument = new Document(documentStream, new LoadOptions()
{
    Encoding = Encoding.GetEncoding(documentEncoding)
});

builder.InsertDocument(htmlDocument, ImportFormatMode.KeepSourceFormatting);

builder.PageSetup.PageStartingNumber = 1;
builder.PageSetup.RestartPageNumbering = true;
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.InsertField("PAGE", string.Empty);
builder.Write(" " + Properties.Resource.Page);

Attached HTML file. Please help to unrsend hoe to fix problem

Thank you

Downloads.7z (32.9 KB)

@Sharon_Dahan Please explain what you are using as the expected display of “source_ShaareZedek_ (3).html”: how it is displayed in the browser or how it is displayed in MS Word? In fact, if you open this Html document in MS Word, its display will be different.

@Vadim.Saltykov Hello … This HTML file we are converting to PDF using aspose. This is in Hebrew.
When we are opening it in browser, its working as expected. There is no change in style.

When I tried to open the same file in MS Word, getting below error
Capture4.JPG (12.5 KB)

Issue is: When we are converting the HTML document to PDF using aspose, styles and alignment is getting changed.
Let us know if any more information is needed.

@imoitra Aspose.Words is designed to work with MS Word documents so usually it mimics MS Word behavior when import HTML documents. HTML format is very different from MS Word formats and there are limitations when convert from HTML to MS Word document model and vice versa. You can find the list of limitations in our documentation:
https://docs.aspose.com/words/net/load-in-the-html-html-xhtml-mhtml-format/
https://docs.aspose.com/words/net/save-in-html-xhtml-mhtml-formats/
So upon conversion HTML document using Aspose.Words there might be layout difference, the same as if convert HTML using MS Word.