I have read the help articles here, here, and here as well as all the existing forum posts but it’s still not working. We have this code:
Document doc = new Document(formDoc);
DocumentBuilder builder = new DocumentBuilder(doc);
string contentRootPath = _env.ContentRootPath;
formFonts = Path.Combine(contentRootPath, "fonts");
FolderFontSource folderFontSource = new FolderFontSource(formFonts, false, 1);
doc.FontSettings = new FontSettings();
doc.FontSettings.SetFontsSources(new FontSourceBase[] { folderFontSource });
The formFonts folder is a folder in the application itself. But it still only will fall back to the default fonts because it can’t find this folder.
Also, this all works perfectly using Docker Desktop on my development machine. It’s only when we deploy it to AWS ECS that it breaks. We also tried copying the files to a folder in the container in the Dockerfile, but that did not work either.
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["web3.csproj", "."]
COPY . .
COPY ./protected/fonts/* /usr/share/fonts/
RUN apt-get update && apt-get install -y libfontconfig1
RUN dotnet restore "./././web3.csproj"
WORKDIR "/src/."
RUN dotnet build "./web3.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./web3.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "web3.dll"]
Any help is appreciated.