I have a single slide PPTX, when I save as PDF, I get a different Font used vs when I save as PPTX.
I have specified the default Font in the load options to be the font used in the PPTX. I have tried changing the default font to other completely different font families and none of them get picked up, regardless of what I set the default font to, the PDF always saves the same way.
The text in the PPTX is in Metropolis and in the PDF it is Metropolis Semi Bold
Sample PPTX and PDF produced are here : ILT-Slides.zip (87.5 KB)
@gkalte,
Thank you for your patience. Unfortunately, I was unable to reproduce the problem you described. Please check your results using the latest version of Aspose.Slides for .NET if it is possible. If the issue persists, please share the following information:
When you say you were unable to reproduce, what does that mean?
You were able to save a PDF, where the text of the one slide was all in Metropolis and not Metropolis Semi-Bold?
Can you upload the PDF you created ?
I am running on windows 10 build 18363
.NET version 4.6.1
I tested your code example with the default font set to other fonts (Arial and Times New Roman, for example), it works fine. By this I meant “unable to reproduce”.
It looks like the Metropolis font has not been installed on your operating system. If you need to use it in the output PDF, you should install the font or load it as external instead of using DefaultRegularFont property.
I have tried the same thing ( Arial and Times New Roman ), and I always get the same result, Metropolis Semi - Bold. The metropolis fonts are installed in the windows font directory. can you post the code change you made to get it use Arial and/or Times New Roman
@gkalte,
I just changed the default font in your code like this:
LoadOptions loadOptions = new LoadOptions(LoadFormat.Auto)
{
DefaultRegularFont = "Times New Roman"
};
Presentation thePres = new Presentation("preview.pptx", loadOptions);
thePres.Save("preview_out.pdf", SaveFormat.Pdf);
With Aspose.Slides 22.1, this is my output PDF: preview_out.pdf (46.9 KB). Could you please confirm you are using the latest version of Aspose.Slides?
Now I’m assuming that the font substitution was done incorrectly on your side. Could you please share the Metropolis and Metropolis Semi-Bold fonts from your system?
@gkalte,
I’ve understood and reproduced the problem with the Metropolis fonts you described. You don’t need to use the DefaultRegularFont property for this case. The wrong Metropolis font was also selected when converting PPTX to PDF on my side.
I added a ticket with ID SLIDESNET-43040 in our issue tracking system. We apologize for any inconvenience. Our development team will investigate this case. You will be notified when the issue is resolved.
You could use a warning callbacks to detect font substitutions as shown below:
PdfOptions pdfOptions = new PdfOptions
{
WarningCallback = new WarningHandler()
};
Presentation presentation = new Presentation("preview.pptx");
presentation.Save("preview_out.pdf", SaveFormat.Pdf, pdfOptions);
class WarningHandler : IWarningCallback
{
public ReturnAction Warning(IWarningInfo warning)
{
Console.WriteLine(warning.WarningType);
Console.WriteLine(warning.Description);
return ReturnAction.Continue;
}
}
But at the moment, there are some problems with warning callbacks for PDF export. So I linked this forum thread to a corresponding task with ID SLIDESNET-41996 in our issue tracking system. You will also be notified when this issue is resolved. Our development team is already working on the issue.
You can try to detect a font substitution during the loading stage of the presentation like this:
LoadOptions loadOptions = new LoadOptions
{
WarningCallback = new WarningHandler()
};
Presentation presentation = new Presentation("preview.pptx", loadOptions);
presentation.Save("preview_out.pdf", SaveFormat.Pdf);
The issues you have found earlier (filed as SLIDESNET-41996) have been fixed in Aspose.Slides for .NET 22.4 (ZIP, MSI).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.