Hi,
I’m using AsposePDF for .Net to replace text in a pdf. While building the system on my local PC (Windows 11), I only had to install one extra font (ShadowsIntoLightTwo-Regular) to get it working. The text I’m replacing makes use of this font.
We plan to deploy using a Linux container in Docker, so I’ve been testing that locally. As far as I can see, I’m adding the font to the container, though I’m not entirely sure how best to check that.
This is the 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:6.0 AS base WORKDIR /app COPY ["PDFTest/ShadowsIntoLightTwo-Regular.ttf", "/tmp"] RUN apt-get update && apt-get install -y fontconfig && mkdir -p /usr/share/fonts/truetype/custom/ && mv /tmp/ShadowsIntoLightTwo-Regular.ttf /usr/share/fonts/truetype/custom/ && fc-cache -fv FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["PDFTest.csproj", "PDFTest/"] RUN dotnet restore "PDFTest/PDFTest.csproj" COPY . . WORKDIR "/src/PDFTest" RUN dotnet build "PDFTest.csproj" -c Release -o /app/build FROM build AS publish RUN dotnet publish "PDFTest.csproj" -c Release -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "PDFTest.dll"]
When I run the project in docker, it builds, loads the PDF, and attempts to find and replace. At this point, it throws an exception with the error: “Format of font “Symbol” is not supported for new composite fonts”.
I’ve added the lines to list all fonts in use by the pdf:
var fonts = pdfDocument.FontUtilities.GetAllFonts().ToList();
fonts.ForEach(f => Console.WriteLine(f.FontName));
From that I can see that the only fonts used by the pdf are:
VAGRounded-Thin
VAGRounded-Light
VAGRounded-Thin
VAGRounded-Bold
VAGRounded-Bold
AvenirNext-UltraLight
ShadowsIntoLightTwo-Regular
Inspiration-Regular
Any advice to help me get this working?
Thanks,
Mike