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

Free Support Forum - aspose.com

Convert HTML to PDF using C# and Aspose.PDF - Incompatible unit types

I am converting web page html file using Aspose.PDF. I am getting the error message “Incompatible unit types”.

var option = new HtmlLoadOptions() {};
var document = new Document(sourceFilename, new HtmlLoadOptions());
document.Save(targetFilename);

Aspose.PDF works fine on other html file but not on this file. I have attached the sample file.

Thanks[LD-7515] Cannot PDF HTML files - JIRA.zip (91.2 KB)

1 Like

@rainierpaul

We were able to reproduce the issue in our environment while testing the scenario with Aspose.PDF for .NET 20.10. Hence, have logged it as PDFNET-48966 in our issue management system. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

We’re seeing this same issue with Aspose Total 21.6. Is this still being worked or has it been fixed in a later version?

@amcalpine.gdit

You are seeing this issue because it has not been yet resolved. Please note that it is currently under the phase of investigation and as soon as it is fixed, we will update you in this forum thread. Please spare us some time.

We apologize for the inconvenience.

The issues you have found earlier (filed as PDFNET-48966) have been fixed in Aspose.PDF for .NET 21.10.

I’m getting the exact same error “Incompatible unit types” with the attached html file using Aspose.Pdf v22.1 using the exact same code listed above:

var option = new HtmlLoadOptions() {};
var document = new Document(sourceFilename, new HtmlLoadOptions());
document.Save(targetFilename);

Can you please reopen this issue.

ce4cc45e-b123-4902-bd80-87e8ec019950.zip (4.4 KB)

@ted-1

We tested the case using 22.3 version of the API and did not notice any exception. For your kind reference, an output PDF is also attached. Please use the latest version of the API and let us know in case you still notice any issue.
output.pdf (933.3 KB)

Yep, I confirmed this is working again in version 22.3. Unfortunately, we cannot use that version until this fix is in: Can't install Aspose.PDF v22.2 & v22.3 using NuGet for .NET Standard

Question: Why do bugs like this reappear on newer versions after they have been fixed?

@ted-1

Aspose.PDF API has many internal components that depends upon each other. Sometimes, changes to one component can effect on dependent one. During resolving issues and implementing new features/enhancements, possibility of regression is there. If some regression is noticed, we fix it in the very next version.

Thank you, Asad!

1 Like