Hi,
I’m trying to create a simple word document form html and save to docx and pdf.
.NET Core 2.0 on console application works fine, but on a api controller .NET Core 2.0 only save docx run successfully. Save to pdf give me an error.
The code is very simple
public byte[] Render(string html)
{
var doc = new Document();
var builder = new DocumentBuilder(doc);
builder.Writeln("Random text");
builder.InsertHtml(html);
var msResult = new MemoryStream();
doc.Save(msResult, SaveFormat.Docx);
doc.Save(@"C:\temp\aspose.docx", SaveFormat.Docx);
doc.Save(@"C:\temp\aspose.pdf", SaveFormat.Pdf); //<-- this line throw exception
msResult.Position = 0;
return msResult.ToArray();
}
And this is the error:
The type initializer for ‘SkiaSharp.SKAbstractManagedStream’ threw an exception.
System.TypeInitializationException: The type initializer for ‘SkiaSharp.SKAbstractManagedStream’ threw an exception. —> System.DllNotFoundException: Unable to load DLL ‘libSkiaSharp’: Impossibile trovare il modulo specificato. (Exception from HRESULT: 0x8007007E)
at SkiaSharp.SkiaApi.sk_managedstream_set_delegates(IntPtr pRead, IntPtr pPeek, IntPtr pIsAtEnd, IntPtr pHasPosition, IntPtr pHasLength, IntPtr pRewind, IntPtr pGetPosition, IntPtr pSeek, IntPtr pMove, IntPtr pGetLength, IntPtr pCreateNew, IntPtr pDestroy)
at SkiaSharp.SKAbstractManagedStream…cctor()
— End of inner exception stack trace —
at SkiaSharp.SKAbstractManagedStream…ctor(Boolean owns)
at SkiaSharp.SKManagedStream…ctor(Stream managedStream, Boolean disposeManagedStream, Boolean owns)
at SkiaSharp.SKManagedStream…ctor(Stream managedStream, Boolean disposeManagedStream)
at SkiaSharp.SKBitmap.WrapManagedStream(Stream stream)
at SkiaSharp.SKBitmap.Decode(Stream stream)…
Can you help me?
Thank you.