一. 问题描述
- 使用netcore开发 (netcore3.1+NuGet引用的Aspose.Words 20.7)
- word内容中包含图片时, 在window10系统下运行正常, 部署在linux(Linux 3.10.0-957.el7.x86_64 x86_64
)系统下生成word异常.
二. 生成word代码 示例
Aspose.Words.Document doc = new Aspose.Words.Document();
Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(doc);
// 方法1 插入图片
builder.InsertImage(HttpContext.MapPath("/data/image.jpg", true), 400, 600);
//方法2 插入图片
builder5.InsertHtml("");
doc.Save(HttpContext.MapPath("/test.docx", true));
三. 错误日志
Unhandled exception. System.TypeInitializationException: The type initializer for ‘SkiaSharp.SKObject’ threw an exception.
—> System.TypeInitializationException: The type initializer for ‘SkiaSharp.SKColorSpace’ threw an exception.
—> System.DllNotFoundException: Unable to load shared library ‘libSkiaSharp’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSkiaSharp: cannot open shared object file: No such file or directory
at SkiaSharp.SkiaApi.sk_colorspace_new_srgb()
at SkiaSharp.SKColorSpace…cctor()
— End of inner exception stack trace —
at SkiaSharp.SKColorSpace.EnsureStaticInstanceAreInitialized()
at SkiaSharp.SKObject…cctor()
— End of inner exception stack trace —
at SkiaSharp.SKObject.DeregisterHandle(IntPtr handle, SKObject instance)
at SkiaSharp.SKObject.set_Handle(IntPtr value)
at SkiaSharp.SKNativeObject.Dispose(Boolean disposing)
at SkiaSharp.SKObject.Dispose(Boolean disposing)
at SkiaSharp.SKBitmap.Dispose(Boolean disposing)
at SkiaSharp.SKNativeObject.Finalize()