Last active
December 24, 2015 21:19
-
-
Save matstani/6864398 to your computer and use it in GitHub Desktop.
ClojureでiTextを利用した日本語PDFファイル出力
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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