Hello,
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
Exception:
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.