We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error - Incompatible unit types - When converting HTML to PDF with C#

I am converting a generated html string using Aspose.PDF version 22.8. I am getting the error message “Incompatible unit types”.

    byte[] byteArray = Encoding.ASCII.GetBytes(html);
            MemoryStream stream = new MemoryStream(byteArray);
            Document htmlToPdfResult = new Document(stream, options);

Aspose.PDF works fine on other html strings but not on this one. It also works fine if I comment out all instances of display: flex; in the css, but obviously, then it does not display correctly!
I have attached a sample html file that is a saved result of the html string before being passed to Aspose.SampleHtml.zip (12.6 KB)

I have referenced this post, but as it’s noted as fixed, I don’t believe it’s the same issue: Convert HTML to PDF using C# and Aspose.PDF - Incompatible unit types

@courtenaywatson

We were able to reproduce the issue in our environment while testing the scenario using 22.9 version of the API. It has been logged as PDFNET-52543 in our issue tracking system. We will further look into its details and let you know as soon as it is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.