天天看點

對itext導出PDF的一些小總結,以及ireport中生成中文PDF

也許大家和我一樣,為了pdf生成時産生中文而苦惱,也許你和我一樣,看到别人提供了一堆的jar,而找不到下載下傳的地方,我也是找了好久才找到最後的大學營的,特寫出來,友善你我他;)

也算給自己1個多小時的時間的一點見證吧.-_#

你隻要去

<a href="http://prdownloads.sourceforge.net/itext/">http://prdownloads.sourceforge.net/itext/</a>

就可以找到所有你想要的東西.包括itext最新版本,itext亞洲語言包

========================

不信?試試好的話記得頂一個呵呵!

===============順便再補充一下

在java中,用ireport是個不錯的報表設計工具咯,可視化操作,但也有中文問題。典型的是加入itext後,中文顯示亂碼,并且導出到pdf後也亂碼,解決方法經過探索後有如下方法解決:

2 在itext文本的屬性框中,設定字型的屬性為:

font name: sansserif

pdf font name: stsong-light;

pdf embedeed encoding前的勾選上

pdfencoding :unigb-ucs2-v (chinese simplified)

這樣就可以解決了ireport中的pdf中文問題了;)

============

簡單的說

在字型那裡按照這種規則選擇.

chinese simplified

stsong-light with the encodings unigb-ucs2-h and unigb-ucs2-v

chinese traditional

mhei-medium and msung-light with the encodings unicns-ucs2-h and unicns-ucs2-v

japanese

heiseikakugo-w5 and heiseimin-w3 with the encodings unijis-ucs2-h,unijis-ucs2-v,unijis-ucs2-hw-h and unijis-ucs2-hw-v

korean

hygothic-medium and hysmyeongjo-medium with the encodings uniks-ucs2-h and uniks-ucs2-v