Free Support Forum - aspose.com

HTML to PDF multiple issues with Aspose.HTML 20.4.0 and UWP targeting 10.0.16299

Hello,

We are facing multiple issues when trying to use Aspose.HTML in a UWP app.

  1. the license file cannot be loaded via the following code:

             var license = new Aspose.Html.License();
             var assembly = this.GetType().GetTypeInfo().Assembly;
             var resource = assembly.GetManifestResourceStream("xxx.Assets.Aspose.Total.lic");
             license.SetLicense(resource);
    

The last line generates the following exception:

Assembly.Load(byte[], …) is not supported in AppX.

Note: if I run the same code but with Aspose.Cells.License() instead of Aspose.Html.License(), it works fine.

  1. If I remove the code above and move on, there is another issue:

             var doc = new HTMLDocument();
             doc.DocumentElement.OuterHTML = "<p>Hello World</p>";
             Aspose.Html.Converters.Converter.ConvertHTML(doc, new PdfSaveOptions(), Path.Combine(ApplicationData.Current.LocalFolder.Path, "test.pdf"));`
    

The last line throws the exception:

System.PlatformNotSupportedException: ‘System.Drawing is not supported on this platform.’
at System.Drawing.Drawing2D.Matrix…ctor(Single m11, Single m12, Single m21, Single m22, Single dx, Single dy) (…)

I’ve checked and these issues do not appear when I run the same code in a non-UWP project with Aspose.HTML 20.4.0 but targets .NET framework 4.6.1.

Unfortunately I cannot provide the full code to reproduce this issue due to insufficient permissions in my environment.

Any ideas why these issues appear in the UWP app but not in the .NET 4.6.1 project ?

Thanks

@flop,

Thanks for contacting support.

Can you please share sample project to further investigate this issue on our end. Also please share source files as well.

@Adnan.Ahmad,

Here is a sample project with the aforementioned issues.
AsposeTests.zip (24.9 KB)

I’ve cleared the contents of the license file, but as I wrote before, I’m confident our license is valid because if I run the same code and same Aspose Nuget package in a .NET 4.6.1 project, there is no issue.

Thanks for the help.

@flop,

Can you please share complete environment details with us for further investigation.