Create a gist now

Instantly share code, notes, and snippets.

@matstani /core.clj
Last active Dec 24, 2015

What would you like to do?
ClojureでiTextを利用した日本語PDFファイル出力
(ns try-itext.core
(:import [com.itextpdf.text
Document PageSize Paragraph Font
pdf.PdfWriter pdf.BaseFont]
[java.io FileOutputStream])
(:gen-class))
(defn create-pdf []
(with-open [pdf-doc (Document. PageSize/A4 50 50 50 40)]
(doto pdf-doc
(PdfWriter/getInstance (FileOutputStream. "test.pdf"))
.open
(.add (Paragraph. "こんにちは、世界!"
(Font. (BaseFont/createFont
"HeiseiKakuGo-W5"
"UniJIS-UCS2-H"
BaseFont/NOT_EMBEDDED)))))))
(defn -main
[& args]
(create-pdf))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment