#pragma section-numbers off [[TableOfContents]] = 概要 = ここでは基本的にPDFをプログラムから作成する方法を記述します。 = PDF仕様 = http://partners.adobe.com/asn/developer/technotes/acrobatpdf.html [http://www.antenna.co.jp/PDF/reference/ PDF関連参考資料] = Javaからの出力 = [http://partners.adobe.com/asn/developer/acrosdk/forms.html FDF Toolkit] [http://www.lowagie.com/iText/ iText - a JAVA-PDF library]ライセンスはMPLになる = iText = 手書きでもいいですが、iTextを利用します。 == インストール == http://www.lowagie.com/iText/docs.html#download から最新版を取得します。 日本語を利用する場合は以下も必要になります。 ftp://ftp.lowagie.com/iText/iTextAsian.jar クラスパスを通します。 == 日本語の出力 == コンパイル時の注意としてjavac -encodingで正確なencodingを指定してコンパイルしてください。 Mac OS XにおけるJavaのデフォルトエンコーディングはSJISですからファイルをSJISで作成しておくとあまり気にする必要はありませんが、、 {{{ import com.lowagie.text.*; import com.lowagie.text.pdf.*; public class SampleJapanese { public static void main(String[] args) { Document doc = new Document(); try { PdfWriter pdfwriter = PdfWriter.getInstance(doc, new FileOutputStream("Chap0101.pdf")); BaseFont bf = BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H",false); doc.open(); Paragraph p = new Paragraph("漢字かな文字変換を可能に", new Font(bf, 18)); doc.add(p); // 線を引く Graphic g = new Graphic(); g.setHorizontalLine(5f, 100f); doc.add(g); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } doc.close(); } } }}} = PDFライブラリ = http://member.nifty.ne.jp/~masumoto/clibpdf/ http://www.pdflib.com/ = Winでの便利ソフト類 = Mac OS Xでは不要なんだけどね。 [http://www.forest.impress.co.jp/article/2006/08/09/livepdfprinter.html 窓の杜 - 【NEWS】注釈やURLリンクを埋め込めるフリーのPDF文書作成ソフト「ライブPDFプリンタ」] [http://www.primopdf.com/ Free PDF Converter - create high-quality PDF from any printable file type] [http://homepage.oniduo.pt/pdfe/default.html PDF Explorer- Organizing pdf documents has never been so easy!]:結合や分割をするソフト = 参考サイト = [http://www1.kcn.ne.jp/~k-tm/KTworld/tandt/index.html AcrobatTipe&Techniques] [http://seminars.seyboldreports.com/1998_new_york/etape47.html PDF: A Look Inside] [http://www.kobu.com/pdf/pdfxhand.htm 手書きPDF入門] [http://www.inouedon.com/pdfml-j/ PDFメーリングリスト] http://www.gihyo.co.jp/magazines/wdpress/support/Vol11 [http://www.cc.rim.or.jp/~egami3/iText/ iTextを用いたPDFファイルの作成] http://www31.ocn.ne.jp/~h_ishida/xdoc2txt.html [http://www.primopdf.com/ Free PDF Converter - create high-quality PDF from any printable file type] ---- CategoryPrograming CategoryJava