Aspose.Slidesにおけるフォント置換のための警告コールバックの取得
Contents
[
Hide
]
Aspose.Slides for Javaは、レンダリングプロセス中に使用されるフォントがマシンに存在しない場合に、フォント置換のための警告コールバックを取得することを可能にします。警告コールバックは、レンダリングプロセス中に発生するフォントの欠損やアクセス不可能な問題をデバッグするのに役立ちます。
Aspose.Slides for Javaは、レンダリングプロセス中に警告コールバックを受け取るためのシンプルなAPIメソッドを提供します。以下の手順に従って警告コールバックを設定してください。
- コールバックを受け取るためのカスタムコールバッククラスを作成します。
- LoadOptionsクラスを使用して警告コールバックを設定します。
- ターゲットマシンで使用できないフォントを含むプレゼンテーションファイルをロードします。
- スライドのサムネイルを生成してその効果を確認します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Setting Warning Callbacks | |
LoadOptions lo = new LoadOptions(); | |
lo.setWarningCallback(new HandleFontsWarnings()); | |
//Instantiate the presentation | |
Presentation presentation = new Presentation("Test.ppt", lo); | |
//Generating slide thumbnail | |
for(ISlide slide : presentation.getSlides()){ | |
BufferedImage image = slide.getThumbnail(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HandleFontsWarnings implements IWarningCallback | |
{ | |
public int warning(IWarningInfo warning) | |
{ | |
System.out.println(warning.getWarningType()); // 1 - WarningType.DataLoss | |
System.out.println(warning.getDescription()); // "Font will be substituted from X to Y" | |
return ReturnAction.Continue; | |
} | |
} |