We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Text with Custom Fonts Is Rendered as Blank on mcr.microsoft.com/dotnet/aspnet:7.0-alpine

When we try to convert a presentation that has some text with a custom font, the text in the resulting PDF is rendered as blank. We use In-Memory fonts to load the corresponding custom font. Works fine on windows, but when we render in container that is based on mcr.microsoft.com/dotnet/aspnet:7.0-alpine it doesn’t work. In the attachment there is a simple code sample as well as an example docker file that we use to run the application on production.
Tests.Alpine.zip (58.8 KB)

@arst,
Thank you for describing the issue.

Could you please also share your output PDF file?

Input: Presentation.7z (24.3 KB)
Output: output.7z (1.5 KB)

@arst,
Thank you for the output file. Please try loading the external font before instantiating the presentation like this

FontsLoader.LoadExternalFont(fontContent);

instead of the following way

DocumentLevelFontSources = new FontSources
{
    MemoryFonts = fonts.ToArray()
}

We will be waiting for your results.

Here is the result: Alpine_ConvertedPDF.pdf (21.3 KB). It’s still blank.
Here is the code that we use to generate it:

using Aspose.Slides;
using Aspose.Slides.Export;

public static class PowerPointToPdf
{
    public static async Task Convert()
    {
        var sourceStream = File.OpenRead(Path.Combine("Samples", "Presentation.pptx"));
        Console.WriteLine($"Loaded presentation (size: {sourceStream.Length})");
        var fontContent = await File.ReadAllBytesAsync(Path.Combine("Samples", "LimeGloryCaps.ttf"));
        Console.WriteLine($"Loaded font file (size: {fontContent.Length})");
        var fonts = new byte[][] { fontContent };
        FontsLoader.LoadExternalFont(fontContent);
        var presentation = new Presentation(sourceStream);
        await using var outputStream = new MemoryStream();
        Console.WriteLine($"Starting conversion to PDF");
        presentation.Save(
            outputStream,
            SaveFormat.Pdf,
            new PdfOptions
            {
                Compliance = PdfCompliance.PdfUa
            });
        outputStream.Position = 0;
        Console.WriteLine($"Conversion to PDF finished");
        await File.WriteAllBytesAsync(@"Samples/ConvertedPDF.pdf", outputStream.ToArray());
        Console.WriteLine($"Saved PDF file (size: {outputStream.Length})");
    }
}

On windows still works fine, here is the genaretaed output: Windows_ConvertedPDF.pdf (39.0 KB)

@arst,
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESNET-43752

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.