[Public] How to run IronPdf on Windows Server Core Container?
Windows Server Core 2019/2022 Containers only include the Lucon font by default, which isn’t enough for IronPdf. To render PDFs correctly, you need to manually install fonts like Arial.
IronPdf requires certain system fonts to properly render content when generating PDFs. Windows Server Core 2019 and 2022 come with only a few built-in fonts, mainly just Lucon. This limited font support makes IronPdf incompatible by default.
To make IronPdf work in a Server Core container, you must install additional fonts like Arial. Below is a sample Dockerfile that shows how to copy and register the Arial font:
```
FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2022 as base
USER ContainerAdministrator
WORKDIR C:/
COPY arial.ttf c:/windows/fonts/arial.ttf
RUN powershell.exe -NoProfile -Command New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' -Name 'Arial (TrueType)' -PropertyType String -Value arial.ttf
```
Explanation of the Dockerfile commands:
-
USER ContainerAdministrator
: Grants permission to modify the system registry and install fonts. -
COPY arial.ttf c:/windows/fonts/arial.ttf
: Copies the Arial font file into the system fonts directory. -
New-ItemProperty
: Adds a new registry entry for the Arial font so that the system recognizes and can use it during PDF rendering.
Note: This solution does not work with Windows Server Nano containers. Nano Server is a highly trimmed-down version of Windows that lacks key font rendering libraries and does not support font installation, making it incompatible with IronPdf.