SKFontManager throwing exception when generating PDF with DevExpress Reports in Docker Linux Container

105 Views Asked by At

I'm encountering an issue while generating PDF files using DevExpress Reports within a Docker Linux container. The error message I'm receiving is:

The type initializer for 'SkiaSharp.SKFontManager' threw an exception.

This problem doesn't occur when running the application on Windows, but it persists when deploying it within a Linux Docker container.

I've attempted to resolve this by ensuring that necessary dependencies are installed within the container, such as libfontconfig1, libfreetype6 and others. Here are the commands I've tried:

apt-get update && \
apt-get install -yq nodejs && \
apt-get install -yq nodejs libfontconfig1 libfreetype6 && \
rm -rf /var/lib/apt/lists/*

apt update && \
apt install -y libc6 && \
apt install -y libgcc1 && \
apt install -y libgssapi-krb5-2 && \
apt install -y libicu66 && \
apt install -y libssl1.1 && \
apt install -y libfontconfig1 && \
apt install -y libicu-dev && \
apt install -y libjpeg-turbo8 && \
apt install -y libstdc++6 && \
apt install -y zlib1g && \
apt install -y gnupg ca-certificates && \

Despite these efforts, the error persists, particularly when the application reaches the XtraReport instance to load the layout for PDF files, even after upgrading to .NET 7.

I would appreciate any insights or suggestions on how to resolve this issue and successfully generate PDF files within the Docker Linux container. Thank you in advance for your assistance.

1

There are 1 best solutions below

0
Alessandro Rossi On

Had the same exact issue with DevExpress.Reporting.Core and DevExpress.Drawing.Skia 23.2.3 running on Docker Linux container.

Docker container is now generating PDF files.

Project is .NET 8 Api, in the Program.cs file:

if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
    DevExpress.Drawing.Internal.DXDrawingEngine.ForceSkia();
}

Then in the container shell:

apt update
apt install libfreetype6 libfontconfig1 libjpeg62-turbo libpng16-16 zlib1g libx11-6 libxext6 libxrandr2 libxinerama1 libxcursor1 libxi6

Hope this helps.