Converting a Presentation to HTML in Java Uses Wingdings Instead of Calibri

Hello,

when converting a specific PowerPoint slide (that was created based on a master template) to HTML, characters in Calibri font (but quite sure it’s not specific to this font) are not correctly converted. The characters are displayed in Wingdings.
Text in the same font that was created as a new 2nd page in the same slides works correctly.

We tested it with Aspose.Slides for Java 25.2.

This is the code we used:

HtmlOptions options = new HtmlOptions();
options.setHtmlFormatter(HtmlFormatter.createDocumentFormatter("", false));
INotesCommentsLayoutingOptions layoutingOptions = options.getNotesCommentsLayouting();
layoutingOptions.setNotesPosition(NotesPositions.None);
 
Presentation doc = new Presentation(inputStream);
 
// scaleByMaintainingAspectRatio
ISlideSize slideSize = doc.getSlideSize();
double aspectRatio = slideSize.getSize().getWidth() / slideSize.getSize().getHeight();
int newHeight = (int) (RESULT_WIDTH_IN_PX / aspectRatio);
slideSize.setSize(RESULT_WIDTH_IN_PX, newHeight, SlideSizeScaleType.EnsureFit);
 
doc.save(outputStream, SaveFormat.Html,  options);

Is this an Aspose bug or are we doing something wrong? Can we work around it?
Thanks a lot for your support!

Kind regards,
Stefan Raubal

@stefan.raubal,
Thank you for posting the questions.

The replacement of the Calibri font with Wingdings may occur because Calibri is missing on the operating system where the conversion is performed. Please make sure the Calibri font is installed on the system.

Alternatively, you can load the font as an external font before performing the conversion, as shown below:

FontsLoader.loadExternalFonts(new String[]{"path_to_folder_with_fonts"});

Custom PowerPoint Font in Java|Aspose.Slides Documentation

If this does not work for you, please share the following:

  • sample presentation file
  • output HTML file
  • OS version where the conversion is performed
  • JDK target version in your application project

Hello @andrey.potapov ,

as the screenshot shows, the second slide in the same PowerPoint presentation shows the font Calibri correctly.
The problem only occurs when the font is defined already via the master template (page one is created based on the template, while page two is a newly created one).

This is a problem for our customers as they have their company CI/CD and therefore all their presentations are based on slide templates!

Thanks for further investigation.
Stefan

Here are the requested attachments, I forgot to add them in the first post:
aspose_slides_bug.zip (32.3 KB)

  • OS version where the conversion is performed: Red Hat Enterprise Linux 8.10 (Ootpa)
  • JDK target version in your application project: OpenJDK Runtime Environment Corretto-17.0.14.7.1

@stefan.raubal,
Thank you for the additional information. I’ve reproduced the problem with the fonts.

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): SLIDESJAVA-39652

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.

@stefan.raubal,
Our developers have investigated the issue. The issue is related to the absence of required fonts on Linux. Since plain HTML is used, the necessary fonts must be available to correctly calculate character positions.

Additionally, the HTML page you provided uses Cantarell instead of Calibri, which is also not the expected behavior.

To fix this, simply use the FontsLoader with the Calibri and Wingdings fonts.

In addition, we recommend considering HTML5 output, as it allows you to generate an HTML file without additional font requirements.
html5-output.zip (23.2 KB)

INotesCommentsLayoutingOptions layoutingOptions = new NotesCommentsLayoutingOptions();
layoutingOptions.setNotesPosition(NotesPositions.None);

Html5Options options = new Html5Options();
options.setNotesCommentsLayouting(layoutingOptions);
options.setOutputPath("page_content");

Presentation doc = new Presentation("aspose_slides_bug.pptx");

doc.save("output5.html", SaveFormat.Html5,  options);