Hello,
I noticed an issue that PNG files have an error when you save a word document as image under Linux docker container.
Test code:
var lic = new License();
lic.SetLicense(@"./data/Aspose.Total.NET.lic");
var doc= new Document(@"./data/tmp/thumbnails/in.docx");
var options = new ImageSaveOptions(SaveFormat.Png);
var pageRange = new PageRange(0, 0);
options.PageSet = new PageSet(pageRange);
doc.Save(@"./data/tmp/thumbnails/out.png", options);
Dockerfile:
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/runtime:7.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["ConsoleApp3/ConsoleApp3.csproj", "ConsoleApp3/"]
RUN dotnet restore "./ConsoleApp3/ConsoleApp3.csproj"
COPY . .
WORKDIR "/src/ConsoleApp3"
RUN dotnet build "./ConsoleApp3.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./ConsoleApp3.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
#Include contrib archive to install windows fonts. Must run before package update
RUN sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list
#Installs "windows fonts"
RUN apt-get update && apt-get install -y ttf-mscorefonts-installer fontconfig
#SkiaSharp dependency of Aspose requires libfontconfig1. See Aspose documentation for this.
RUN apt-get update && apt-get install -y libfontconfig1
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ConsoleApp3.dll"]
Project config (nuget packages):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aspose.Words" Version="24.3.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.7" />
</ItemGroup>
</Project>
Test Files:
sample_files.zip (169.3 KB)
The produced PNG file under linux cannot be handled in some programming languages (delphi) due to an CRC error. The CRC error also can be validated through PNG file chunk inspector
image.png (87.9 KB)
As I am writing this, I noticed the PNG produced under windows also has a CRC error listed. The original document with which we first noticed the error was correct under windows and with CRC error under linux.
I cannot attach the full document but here are the PNG files from the other sample we had:
other results.zip (153.8 KB)
In both cases, the PNG produced by the docker container also is significantly larger (122 kb vs 65 kb and 108 kb vs 67 kb),
Thanks for your help.
Daniel