When using FontFolders and the Calibri font is in one of those folders we are getting a error on save. Using any pptx originally created in PowerPoint.
Font ‘?’ cannot be found.
at System.Drawing.FontFamily.GetCellAscent(FontStyle style)
at .(Font , Single& , Single& , Single& )
at .(String , , , Boolean , Int32 , Single& , Single& )
at .( , , , , Int32 , Single& , Single& , Single& )
at .() at …ctor(TextFrame , Single , Single , IBaseSlide , )
at Aspose.Slides.TextFrame.(Single , Single , IShapeStyle , )
at Aspose.Slides.TextFrame.(ShapeFrame& , RectangleF& , Single& , Single& , Single& , Single& , )
at .(IAutoShape , , , )
at .(IGroupShape , , , )
at .(IBaseSlide , , )
at .(IMasterSlide , Boolean )
at .( , IMasterSlide , Boolean , )
at .(IPresentation , Stream , PresentationTypeEx , IPptxOptions , InterruptionToken )
at Aspose.Slides.Presentation.(Stream , PresentationTypeEx , IPptxOptions )
at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
If Calibri is not in the folder there is no error.
If Ubuntu is used instead of Alpine there is no error.
No error from Aspose.Words or Aspose.Cells with a similar test.
Application is a ASP.NET site using .NET Core v3.1.
Load code
var opts = new Aspose.Slides.LoadOptions();
opts.DocumentLevelFontSources.FontFolders = new string[] { "{local folder}" };
return new Aspose.Slides.Presentation(
documentStream,
opts);
Save code
using var ms = new MemoryStream();
document.Save(ms, SaveFormat.Pptx);
Docker
FROM mcr.microsoft.com/dotnet/aspnet:3.1-alpine
WORKDIR /app
COPY Product .
#default environment variables
ENV Logging__LogLevel__Default=Warning
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
RUN apk update
RUN apk --no-cache add icu-libs msttcorefonts-installer fontconfig harfbuzz-dev tzdata &&
update-ms-fonts &&
fc-cache -f
RUN apk --no-cache add libgdiplus --update-cache --repository Index of /alpine/edge/testing/ --allow-untrusted
ENTRYPOINT [“dotnet”, “Product.dll”]