Problem with functionality after uploading to the server

Hello, I have a problem, I built a functionality that converts a docx to pdf and this docx has an image.
It performs the conversion perfectly on my machine but when I upload to the Docker server I use it converts but doesn’t bring the image.
Is there something that should be done in the dockerfile for this functionality?
Or something like that?

@anemam Aspose.Words for .NET Standard and .NET6 use SkiaSharp to deal with graphics, to make it work on Linux you have to add reference either to SkiaSharp.NativeAssets.Linux or to SkiaSharp.NativeAssets.Linux.NoDependencies

If you add reference to SkiaSharp.NativeAssets.Linux, you should also install libfontconfig1 in your system. SkiaSharp.NativeAssets.Linux depends on this library. You can use the following command to install it:

apt-get update && apt-get install -y libfontconfig1

If you do not have rights to install packages, or other reasons not to install libfontconfig1, you can simply use SkiaSharp.NativeAssets.Linux.NoDependencies, which does not require installation of libfontconfig1.

For your reference here is a simple Dokerfile configuration, that works fine on my side:

FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base

WORKDIR /app

RUN apt-get update && apt-get install -y libfontconfig1

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["TestNet6.csproj", "."]
RUN dotnet restore "./TestNet6.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "TestNet5.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "TestNet6.csproj" -c Release -r linux-x64 --no-self-contained -o /app/publish

FROM base AS final

WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TestNet6.dll"]

Here is Dependencies list in the .csproj:

<PackageReference Include="Aspose.Words" Version="23.5.0" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.80.3" />

Hello, Perfect!
This solutions worked correctly!

Thank you

1 Like