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

Free Support Forum - aspose.com

Fatal exception occurs when converting PPT to PDF

90691621935178_.pic_hd.png (99.4 KB)

public String conversionFile(ConversionDTO conversionDTO){
final String targetPath = conversionDTO.getTargetPath();
String savePath = null;
final String srcPath = conversionDTO.getSrcPath();
savePath = targetPath + conversionDTO.getFileName();
final Presentation pres = new Presentation(srcPath);
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.setWarningCallback(new HandleFontsWarnings());

    final IFontsManager fontsManager = pres.getFontsManager();
    // 获取ppt里面所有的字体
    IFontData[] embeddedFonts = fontsManager.getFonts();
    FontsLoader.loadExternalFonts(new String[]{FileConvertConstant.FONT_PATH});
    try {
        if(embeddedFonts.length > 0){
            for (IFontData embeddedFont : embeddedFonts) {
                final String fontName = embeddedFont.getFontName();

                // 如果ppt中字体在本地不存在
                    log.warn("font :{} lost ",fontName);
                    // 最后指定默认的
                    fontsManager.replaceFont(embeddedFont, new FontData(FileConvertConstant.DEFAULT_FONT));
    }catch (Exception e){

    if (!CollectionUtils.isEmpty(set)){

    pres.save(savePath, SaveFormat.Pdf,pdfOptions);
    return savePath;

Thank you for the query. Unfortunately, I cannot use your code example to investigate this case. Please share and specify the following:

  • a standalone code example reproducing the issue without your application code
  • the presentation file you converted to PDF format
  • the version of Aspose.Slides you used
  • the version of the operating system on which the error appears
  • the version of JDK you used

But first, please check the issue with the latest version of Aspose.Slides.

public void testPdf(){
final String targetPath = “/Users/zyx/Desktop/”;
String savePath = null;
final String srcPath = “/Users/zyx/Downloads/67467-批量使用1-38.pptx”;
savePath = targetPath + “test.pdf”;
final Presentation pres = new Presentation(srcPath);
PdfOptions pdfOptions = new PdfOptions();
pres.save(savePath, SaveFormat.Pdf,pdfOptions);



image.png (79.0 KB)

com.aspose aspose-slides 21.4 jdk16

image.png (69.4 KB)

Thank you for the additional information. I logged the issue in our tracking system with ID SLIDESJAVA-38546. Our development team will investigate this case. I will inform you of any progress.

The issues you have found earlier (filed as SLIDESJAVA-38546) have been fixed in this update.