0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Java ODTファイルをPDFで保存

Posted at

ODTファイル「OpenDocument」 とは、ワープロソフトなどで作成・編集される文書ファイルの標準ファイル形式の一つです。今回はSpire.Presentation for Javaという無料のライブラリを利用して、ODTファイルをPDFに変換する技を紹介していきます。

下準備

1.E-iceblueの公式サイトからFree Spire. Presentation for Java無料版をダウンロードしてください。

f:id:lendoris:20210414112922p:plain

 2.IDEを起動して新規プロジェクトを作成してから、インストールされたファイルにあった相応しいSpire. Presentation.jarを参照に追加してください。

f:id:lendoris:20210414112938p:plain

サンプルコード

```JAVA import com.spire.presentation.*;

public class Test {
public static void main(String[] args) throws Exception {

    Presentation presentation = new Presentation();
    presentation.loadFromFile("toPDF.odp",FileFormat.ODP);

    presentation.saveToFile("output/Result.pdf", FileFormat.PDF);
}

}

<p><img src="https://cdn-ak.f.st-hatena.com/images/fotolife/l/lendoris/20210414/20210414113016.png" alt="f:id:lendoris:20210414113016p:plain" title="" class="hatena-fotolife" itemprop="image" /></p>
<p><strong>以上です</strong></p>
<p><strong>如何でしょうか?簡単でしょう?</strong></p>
<p><strong>もしお役に立てば幸いです、なお、ここまで読んでくださってありがとうございます。</strong></p>
<p><strong> </strong></p>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?