Ppt It seems that there is a memory leak

public String conversionFile(ConversionDTO conversionDTO){
final String targetPath = conversionDTO.getTargetPath();
String savePath = null;
final String srcPath = conversionDTO.getSrcPath();
log.info(">>>>开始解析ppt>>>"+srcPath);
savePath = targetPath + conversionDTO.getFileName();
final Presentation pres = new Presentation(srcPath);
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.setDefaultRegularFont(FileConvertConstant.DEFAULT_FONT);
pdfOptions.setWarningCallback(new HandleFontsWarnings());

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

            log.warn("font :{} not find",fontName);
            // 最后指定默认的
            fontsManager.replaceFont(embeddedFont, new FontData(FileConvertConstant.DEFAULT_FONT));
        }
    }

    pres.save(savePath, SaveFormat.Pdf,pdfOptions);
    log.info(">>>解析成功>>>"+savePath);
    if(Objects.nonNull(pres)){
        pres.dispose();
    }
    return savePath;
}

image.png (52.1 KB)

@zyx,
Thank you for the query. To investigate this case on our side, please share and specify the following:

  • a presentation file you used for converting to PDF
  • your default font you used for PDF export
  • your external fonts loaded with code example
  • the version of the operating system on which the problem appears
  • the version of JDK that your application used
  • the version of Aspose.Slides you used

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