Aspose.Slidesにおけるフォント置換のための警告コールバックの取得
Contents
[
Hide
]
Aspose.Slides for PHP via Javaは、レンダリングプロセス中に使用されているフォントがマシン上で利用可能でない場合に、フォント置換のための警告コールバックを受け取ることを可能にします。警告コールバックは、レンダリングプロセス中に欠落またはアクセス不可のフォントの問題をデバッグするのに役立ちます。
Aspose.Slides for PHP via 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; | |
} | |
} |