PowerPoint プレゼンテーションを PDF に変換する場合、ドキュメントのレイアウトとフォーマットは固定されます。受信者は、Microsoft PowerPoint をインストールせずに変換されたドキュメントを表示できますが、勝手に変更することはできません。この記事では、Spire.Presentation for Java を使用して PowerPoint プレゼンテーションを PDF に変換する方法を示します。 PowerPoint プレゼンテーション全体を PDF に変換する方法 PowerPoint プレゼンテーションの特定のスライドを PDF に変換する方法 Spire.Presentation for Java をインストールします まず、Spire.Presentation for Java を Java プロジェクトに追加する必要があります。JAR ファイルは、このリンクからダウンロードできます。Maven を使用する場合は、次のコードをプロジェクトの pom.xml ファイルに追加する必要があります。 <repositories> <repository> <id>com.e-iceblue</id> <name>e-iceblue</name> <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url> </repository> </repositories> <dependencies> <dependency> <groupId>e-iceblue</groupId> <artifactId>spire.presentation</artifactId> <version>7.8.2</version> </dependency> </dependencies> PowerPoint プレゼンテーション全体を PDF に変換する方法 次の手順は、Spire.Presentation for Java を使用して PowerPoint プレゼンテーション全体を PDF に変換する方法を示しています。 Presentation クラスのインスタンスを作成します。 Presentation.LoadFromFile() メソッドを使用して、PowerPoint プレゼンテーションをロードします。 Presentation.saveToFile(filePath, FileFormat.PDF) メソッドを使用して、ファイルを PDF として保存します。 Java import com.spire.presentation.FileFormat; import com.spire.presentation.ISlide; import com.spire.presentation.Presentation; public class ConvertPowerPointToPDF { public static void main(String []args) throws Exception { //Presentationクラスのインスタンスを作成する Presentation ppt = new Presentation(); //PowerPointプレゼンテーションをロードする ppt.loadFromFile("Sample.pptx"); //ファイルをPDFとして保存する ppt.saveToFile("ToPdf1.pdf", FileFormat.PDF); } } PowerPoint プレゼンテーションの特定のスライドを PDF に変換する方法 次の手順は、Spire.Presentation for Java を使用して PowerPoint プレゼンテーションの特定のスライドを PDF に変換する方法を示しています。 Presentation クラスのインスタンスを作成します。 Presentation.LoadFromFile() メソッドを使用して PowerPoint プレゼンテーションをロードします。 Presentation.getSlides().get(slideIndex) メソッドを使用して、インデックスで特定のスライドを取得します。 ISlide.saveToFile(filePath, FileFormat.PDF) メソッドを使用して、スライドを PDF として保存します。 Java import com.spire.presentation.FileFormat; import com.spire.presentation.ISlide; import com.spire.presentation.Presentation; public class ConvertSlidesToPDF { public static void main(String []args) throws Exception { //Presentationクラスのインスタンスを作成する Presentation ppt = new Presentation(); //PowerPointプレゼンテーションをロードする ppt.loadFromFile("Sample.pptx"); //2枚目のスライドを取得する ISlide slide= ppt.getSlides().get(1); //スライドをPDFとして保存する slide.saveToFile("ToPdf2.pdf", FileFormat.PDF); } } 一時ライセンスを申請する 結果ドキュメントから評価メッセージを削除したい場合、または機能制限を取り除く場合は、についてこのメールアドレスはスパムボットから保護されています。閲覧するにはJavaScriptを有効にする必要があります。 にお問い合わせ、30 日間有効な一時ライセンスを取得してください。