I am running .NET Core 2.1 application inside a Linux Docker Container and Converting Word to PDF. While converting the Font Family isn’t retained and is getting changed.
FROM mcr.microsoft.com/dotnet/core/runtime:2.1-stretch-slim AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:2.1-stretch AS build
WORKDIR /src
COPY ["./.", "PdfPOC/"]
RUN dotnet restore "PdfPOC/PdfPOC.csproj"
COPY . .
WORKDIR "/src/PdfPOC"
RUN dotnet build "PdfPOC.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "PdfPOC.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
#RUN apt-get install -y ttf-mscorefonts-installer
RUN apt-get update && apt-get install -y libfontconfig1 apt-utils libgdiplus libc6-dev
RUN apt-get install -y libfreetype6
ENTRYPOINT ["dotnet", "PdfPOC.dll"]
My Code is -
Aspose.Words.License lic = new Aspose.Words.License();
lic.SetLicense("Aspose.Words.lic");
Aspose.Words.Document word2 = new Aspose.Words.Document(Path.Combine(path, "myword.docx"));
word2.Save(Path.Combine(path, "mypdf.pdf"), Aspose.Words.SaveFormat.Pdf);
The word has a variant of sans-serif font but the converted pdf file has serif font. Also if the word has multiple fonts how to make sure all fonts are retained ?