Aspose.Html :System.PlatformNotSupportedException: System.Drawing is not supported on this platform


We are running Aspose.HTML in a linux docker container (openshift platform container).
While converting html to pdf getting below exception on linux working fine in windows.

Aspose.HTML : 23.9.0
.Net 6


System.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform.
   at System.Drawing.Drawing2D.Matrix..ctor(Single m11, Single m12, Single m21, Single m22, Single dx, Single dy)
   at Aspose.Html.Rendering.Pdf.PdfDevice.BeginPage(SizeF size)
   at âââ.âââââ(IDevice , CancellationToken )
   at â
ââ.âââââ(Renderer , âââ[] , IDevice , CancellationToken)
   at Aspose.Html.Rendering.HtmlRenderer.(IDevice , CancellationToken , Element[] , Document[])
   at Aspose.Html.Rendering.HtmlRenderer.Render(IDevice device, TimeSpan timeout, Document[] documents)
   at Aspose.Html.Rendering.Renderer`1.Render(IDevice device, TDocument document, TimeSpan timeout)
   at Aspose.Html.Rendering.Renderer`1.Render(IDevice device, TDocument document)
   at â
â , IDevice )
   at â
â , PdfSaveOptions , ICreateStreamProvider )
   at Aspose.Html.Converters.Converter.ConvertHTML(HTMLDocument document, PdfSaveOptions options, ICreateStreamProvider provider)

Sample code

 using var document = new HTMLDocument("<html><body><p>Html data</p></body></html>", "."); 
                using var streamProvider = new MemoryStreamProvider(); 
                Converter.ConvertHTML(document, new Aspose.Html.Saving.PdfSaveOptions(), streamProvider); 
                var memory = streamProvider.Streams.First();
                memory.Seek(0, SeekOrigin.Begin); 
                byte[] bytes = memory.ToArray();
                System.IO.File.WriteAllBytes("C:/Emailcontent.pdf", bytes); 

What will be the replacement for system.drawing.common or share docker commands that will work or any alternate way to convert html to pdf which supports on Linux.


Can you please also share your docker file for our reference? We will log an investigation ticket and share the ID with you.

DockerFile.pdf (2.0 KB)


We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): HTMLNET-4980

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.


Would you please specify whether the following option has been added to the project file:

<RuntimeHostConfigurationOption Include="System.Drawing.EnableUnixSupport" Value="true" />

Learn more about using the Aspose library.Html can be viewed in the documentation: