AdobeAcrobat
概要
ここでは基本的にPDFをプログラムから作成する方法を記述します。
PDF仕様
http://partners.adobe.com/asn/developer/technotes/acrobatpdf.html
Javaからの出力
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/
Winでの便利ソフト類
Mac OS Xでは不要なんだけどね。
窓の杜 -【NEWS】注釈やURLリンクを埋め込めるフリーのPDF文書作成ソフト「ライブPDFプリンタ」
Free PDF Converter - create high-quality PDF from any printable file type
PDF Explorer- Organizing pdf documents has never been so easy!:結合や分割をするソフト
Macでの便利ソフト類
読んだり管理したりを便利にする
参考サイト
http://www.gihyo.co.jp/magazines/wdpress/support/Vol11
http://www31.ocn.ne.jp/~h_ishida/xdoc2txt.html
Free PDF Converter - create high-quality PDF from any printable file type
