Free Support Forum -

FontRepository.FindFont("Liberation Sans") not found: Alpine Linux, ASP.NET Core 3.1, Aspose.PDF 20.11

FontRepository.FindFont(“Arial”) works when the following is run in the Dockerfile.

RUN apk --no-cache add msttcorefonts-installer fontconfig
RUN update-ms-fonts
RUN fc-cache -f

However, we want to use the open source fonts. Here is the install we are running for the ttf fonts.

RUN apk --no-cache add ttf-liberation fontconfig
RUN fc-cache -f

When we run FontRepository.FindFont(“Liberation Sans”), we get an an error saying the font cannot be found.

fc-match and fc-list confirm that Liberation Sans is being installed successfully in the container.

Please advise how we can use an open source version of Arial in Linux using Aspose.PDF.


Please try to check if newly installed font is in the same directory where Arial font is present. You can use following line of code as well if desired font is present in a different folder:

Aspose.Pdf.Text.FontRepository.Sources.Add(new FolderFontSource("<user's path to ms fonts>"));

Furthermore, try to load font using font stream e.g. FontRepository.OpenFont(). Please let us know in case you still face any issue.