Aspose Word v18.8.0中的“ SkiaSharp.SKImageInfo”异常

问题描述 投票:0回答:1

使用Aspose Word(v18.8.0)将文档转换为PDF。当我尝试使用Linux(Alpine)在docker容器内执行代码时,Visual Studio内的代码运行良好]

FROM mcr.microsoft.com/dotnet/core/sdk:3.0.100-alpine3.9 AS build-env
WORKDIR /usr/src/app
COPY . .
RUN dotnet publish ./test/test.csproj -c Release -o ./_publish
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0.0-alpine3.9

RUN apk update
RUN apk upgrade --available

RUN apk add libgdiplus --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
RUN apk --no-cache add msttcorefonts-installer fontconfig freetype-dev libjpeg-turbo-dev libpng-dev && \
    update-ms-fonts && \
    fc-cache -f

RUN apk add Goelze.SkiaSharp.NativeAssets.AlpineLinux --version 1.68.0
RUN apk add --no-cache icu-libs
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8

ENV ASPNETCORE_URLS http://+:5000
WORKDIR /app
COPY --from=build-env /usr/src/app/_publish ./
EXPOSE 5000/tcp
CMD ["dotnet", "test.dll"]

错误:

Connection id "0HLRQ2FV5QQ5J", Request id "0HLRQ2FV5QQ5J:00000001": An unhandled exception was thrown by the application.
System.TypeInitializationException: The type initializer for   ' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' 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: Error loading shared library liblibSkiaSharp: No such file or directory
   at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
   at SkiaSharp.SKImageInfo..cctor()

使用Aspose Word(v18.8.0)将文档转换为PDF。当我尝试使用Linux(Alpine)在docker容器内执行代码时,Visual Studio内的代码运行良好...

docker dockerfile alpine aspose aspose.words
1个回答
0
投票

您必须为SkiaSharp添加Linux本机资源,以使其在Linux Alpine中运行。在Goelze.SkiaSharp.NativeAssets.AlpineLinux中添加Nuget参考。同样不要忘记在容器中安装fontconfig

© www.soinside.com 2019 - 2024. All rights reserved.