用iTextSharp做pdf轉換的時候,需要添加水印。文字水印的時候,需要設置字體,查了下文檔。摘錄下解決方案。
iText中輸出中文,有三種方式:
1、使用iTextAsian.jar中的字體
BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",BaseFont.NOT_EMBEDDED);
2、使用Windows系統字體(TrueType)
BaseFont.createFont("C:/WINDOWS/Fonts/SIMYOU.TTF", BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
3、使用資源字體(ClassPath)
BaseFont.createFont("/SIMYOU.TTF", BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
給個原文鏈接:http://hintcnuie.iteye.com/blog/183690
另外有以為仁兄給出了字體和編碼對應,沒有寫明使用,但我猜想應該是針對第一種方案的。摘錄如下,供使用者參考:
- Chinese Simplified:
STSong-Light and STSongStd-Light with the encodings UniGB-UCS2-H and UniGB-UCS2-V - Chinese Traditional:
MHei-Medium, MSung-Light and MSungStd-Light with the encodings UniCNS-UCS2-H and UniCNS-UCS2-V - Japanese:
HeiseiMin-W3, HeiseiKakuGo-W5 and KozMinPro-Regular with the encodings UniJIS-UCS2-H, UniJIS-UCS2-V, UniJIS-UCS2-HW-H and UniJIS-UCS2-HW-V - Korean:
HYGoThic-Medium, HYSMyeongJo-Medium and HYSMyeongJoStd with the encodings UniKS-UCS2-H and UniKS-UCS2-V
另有一仁兄研究比較深入些,給個鏈接吧:http://blog.csdn.net/aeolus1019/article/details/8198900
以上完全摘錄,只做記錄使用,非原創。大家有用到的參考。