Symbols Are Missing / Wrong Displayed in PDF/HTML (Linux, Docker)

Hi,

we are running Aspose.Slides for Net 6.0 in a linux docker container and noticed an issue with several symbols missing or beeing replaced by other characters when saving the presentation as PDF or HTML version; the arrows are displayed as a moon in both output files, the formula stuff is missing / unable to render in the PDF version:
image.png (87.3 KB)

Our csproj is

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.8" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="Aspose.Slides">
      <HintPath>C:\Users\name\Downloads\Aspose.Slides\Aspose.Slides\net6.0\crossplatform\Aspose.Slides.dll</HintPath>
    </Reference>
  </ItemGroup>

  <ItemGroup>
    <None Update="Aspose.Slides.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Update="aspose.slides.drawing.capi_vc14x64.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Update="aspose.slides.drawing.capi_vc14x86.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Update="libaspose.slides.drawing.capi_appleclang_arm64.dylib">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Update="libaspose.slides.drawing.capi_appleclang_x86_64.dylib">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Update="libaspose.slides.drawing.capi_x86_64_libstdcpp_libc2.23.so">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>

The sample code is

// See https://aka.ms/new-console-template for more information

using Aspose.Slides;
using Aspose.Slides.Export;

Console.WriteLine("Hello, World!");

var lic = new License();
lic.SetLicense(@"./files/Aspose.Total.NET.lic");

var pres = new Presentation("./files/in.pptx");

// Save pdf
pres.Save("./files/out.pdf", Aspose.Slides.Export.SaveFormat.Pdf);

// Web version
pres.Save("./files/out.html", SaveFormat.Html);

The dockerfile is

#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:6.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["ConsoleApp5/ConsoleApp5.csproj", "ConsoleApp5/"]
RUN dotnet restore "./ConsoleApp5/ConsoleApp5.csproj"
COPY . .
WORKDIR "/src/ConsoleApp5"
RUN dotnet build "./ConsoleApp5.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./ConsoleApp5.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=0

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

#Install required packages, see example at https://docs.aspose.com/slides/net/how-to-run-aspose-slides-in-docker/
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev

#ICU for Culture Information
RUN apt-get update && apt-get install -y libicu-dev 

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

compose file

services:
  testapp:
    image: consoleapp5:latest
    volumes:
      - ./workspace:/app/files/
    restart: no

Test files:
workspace.zip (94.6 KB)

Idk if that is related to Exception when Setting External Font Directory with Full Path under Linux in C# where we cannot set a font directory correctly to mount a windows font directory and load them. Usually we would run following code as well, which is currently disabled due to the linked open item which maybe is related?

private static void SetFontDirectorySlides(string fontDirectory)
{
    if (!Directory.Exists(fontDirectory))
    {
        return;
    }

    Slides::Aspose.Slides.FontsLoader.LoadExternalFonts(new[] { fontDirectory });

    var sysFontDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Fonts);
    if (Directory.Exists(sysFontDirectory))
        Slides::Aspose.Slides.FontsLoader.LoadExternalFonts(new[] { sysFontDirectory });
}

Thanks for your help

@Serraniel,
Thank you for contacting support. I am working on the issue and will get back to you soon.

@Serraniel,
Thank you for your patience. I’ve reproduced the problem you described.

We have opened the following new ticket(s) in our internal issue tracking system and will investigate the case according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESNET-44627

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@Serraniel,
Our developers have investigated the case. The problem is that the required fonts (Cambria Math, Calibri, Wingdings, and ArialMT) are missing from the container. You should add the necessary font files and command to the Dockerfile to install them. I attach an archive with a ready and working example to this post. You already install the ttf-mscorefonts-installer package but these fonts are not enough. In the example, a folder with the fonts is added and this line is added to the Dockerfile:

COPY ["ConsoleApp5/fonts/*", "/usr/share/fonts/truetype/"]

SampleProject-solved.zip (5.9 MB)