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

Free Support Forum - aspose.com

PPTX to PDF: Text Is Disappearing

Hi

I am evaluating a selection of your Aspose .NET products - I think we will eventually need a Total Site OEM license.

I have spotted a problem with the Slide product. I am converting a pptx file to pdf and the text is disappearing.

Input file:

Output file:

Is this something you can advise on as this is affecting the evaluation outcome.

Thanks
Stef Stachow

I might not have got those links correct, might not be publicly available, please try:

Input:
https://docs.google.com/presentation/d/1Gx0ABgEghHk8YwUazwKPcmr19x9cRGAJ/edit?usp=sharing&ouid=116329689761693012887&rtpof=true&sd=true

Output:
https://drive.google.com/file/d/1uUNZMVb1McJgxtOv07QVmXAMLwQMU3Rj/view?usp=sharing

Thanks
Stef

@stefstachow,
Thank you for reporting the issue.

I’ve managed to receive your files. To help you in the best way, we need some additional data. Please share and specify the following:

  • code example that reproduces the problem with text
  • version of the operating system on which the code was run
  • version of Aspose.Slides you used

Hi - thanks for getting back.

This code was running in dotnet core on MacOS Big Sur 11.6. As you can see from the csproj file, the version is 22.1.0

Thanks

.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <RootNamespace>aspose_word_to_pdf_spike</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Aspose.Cells" Version="22.1.0" />
    <PackageReference Include="Aspose.Slides.NET" Version="22.1.0" />
    <PackageReference Include="Aspose.Words" Version="22.1.0" />
  </ItemGroup>

</Project>

Program.cs:

using System.IO;
using System;
using System.Linq;

namespace aspose_word_to_pdf_spike
{
    class Program
    {
        static void Main(string[] args)
        {

            try
            {
                var license = new Aspose.Words.License();
                license.SetLicense("Aspose.Total.NET.lic");
            }
            catch (Exception e)
            {
                Console.WriteLine("\nThere was an error setting the word license: " + e.Message);
            }

            try
            {
                var license = new Aspose.Cells.License();
                license.SetLicense("Aspose.Total.NET.lic");
            }
            catch (Exception e)
            {
                Console.WriteLine("\nThere was an error setting the cells license: " + e.Message);
            }

            try
            {
                var license = new Aspose.Slides.License();
                license.SetLicense("Aspose.Total.NET.lic");
            }
            catch (Exception e)
            {
                Console.WriteLine("\nThere was an error setting the slides license: " + e.Message);
            }

            foreach (var file in GetFiles("input/docs"))
            {
                Console.WriteLine($"Processing {file}");
                var doc = new Aspose.Words.Document(file);
                doc.Save(
                    Path.Combine("output/docs", Path.GetFileName(file) + ".pdf"),
                    Aspose.Words.SaveFormat.Pdf
                );
                Console.WriteLine("Done");
            }

            foreach (var file in GetFiles("input/sheets"))
            {
                Console.WriteLine($"Processing {file}");
                var doc = new Aspose.Cells.Workbook(file);
                doc.Save(
                    Path.Combine("output/sheets", Path.GetFileName(file) + ".pdf"),
                    Aspose.Cells.SaveFormat.Pdf
                );
                Console.WriteLine("Done");
            }

            foreach (var file in GetFiles("input/slides"))
            {
                Console.WriteLine($"Processing {file}");
                var doc = new Aspose.Slides.Presentation(file);
                doc.Save(
                    Path.Combine("output/slides", Path.GetFileName(file) + ".pdf"),
                    Aspose.Slides.Export.SaveFormat.Pdf
                );
                Console.WriteLine("Done");
            }
        }

        private static string[] GetFiles(string path)
        {
            var allowedExtensions = new[] { ".doc", ".docx", ".pdf", ".ppt", ".pptx", ".xls", ".xslx", ".txt", ".rtf" };
            return Directory.GetFiles(path).Where(file => allowedExtensions.Any(file.ToLower().EndsWith)).ToArray();
        }
    }
}

@stefstachow,
It seems to be the Roboto and Twinkl fonts used in the presentation were not installed on the operating system. Please check if it is the case and install them. Alternatively, you can load the fonts as external using FontsLoader class as shown below:

FontsLoader.LoadExternalFonts(new []{ "folderPath1", "folderPath2" });

Documents: Custom Font
API Reference: FontsLoader Class

Also, you can try to find out the reason by checking warnings that may appear during the presentation loading like this:

LoadOptions loadOptions = new LoadOptions
{
    WarningCallback = new WarningHandler()
};

Presentation presentation = new Presentation("Presentation.pptx", loadOptions);
presentation.Save("Presentation.pdf", SaveFormat.Pdf);
class WarningHandler : IWarningCallback
{
    public ReturnAction Warning(IWarningInfo warning)
    {
        Console.WriteLine(warning.WarningType);
        Console.WriteLine(warning.Description);
        return ReturnAction.Continue;
    }
}

Documents: Getting Warning Callbacks for Fonts Substitution
API Reference: IWarningCallback Interface

However, a font replacement must have performed in your case. So I added a ticket with ID SLIDESNET-43053 in our issue tracking system. We apologize for any inconvenience. Our development team will investigate this case. You will be notified when the problem with the font replacement is resolved.