The Callback of Converting PPT to PDF Seems to Be Invalid

The callback of converting ppt to pdf seems to be invalid, and the waringinfo with missing fonts cannot be obtained

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 FontSubstitutionWarningCollector());

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

public class FontSubstitutionWarningCollector implements IWarningCallback {

    @Override
    public int warning(IWarningInfo iWarningInfo) {
        log.info(JSON.toJSONString(iWarningInfo));
        return 0;
    }
}

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

  • The presentation file for reproducing the problem
  • The output PDF file
  • The version of Aspose.Slides you used
  • The version of the operating system on which the problem occurs

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

image.jpg (95.0 KB)
image.jpg (100.0 KB)

image.jpg (78.1 KB)
I don’t know why I can’t find this font

@zyx,
Unfortunately, FontRepository class doesn’t exist in Aspose.Slides. It seems you are using Aspose.PDF. If so, please describe the issue on Aspose.PDF Product Family forum. Otherwise, we need more details to reproduce the issue.

Another problem is that I didn’t get the callback for missing fonts, but I implements IWarningCallback about sildes

pdfOptions.setWarningCallback(new FontSubstitutionWarningCollector());

public class FontSubstitutionWarningCollector implements IWarningCallback {

@Override
public int warning(IWarningInfo iWarningInfo) {
    log.info(JSON.toJSONString(iWarningInfo));
    return 0;
}

}

when font not find it didn’t print anything

@zyx,
Thank you for the additional information. Please take a look at my answer again.