关于在pdf文件中的中文字体显示

宋体 (TrueType) = SIMSUN.TTF

黑体 (TrueType) = simhei.ttf

楷体_GB2312 (TrueType) = simkai.ttf

仿宋_GB2312 (TrueType) = simfang.ttf

Arial (TrueType) = ARIAL.TTF

Arial 粗体 (TrueType) = ARIALBD.TTF

Arial 粗斜体 (TrueType) = ARIALBI.TTF

Arial 斜体 (TrueType) = ARIALI.TTF

Courier New 粗体 (TrueType) = COURBD.TTF

Courier New 粗斜体 (TrueType) = COURBI.TTF

Courier New 斜体 (TrueType) = COURI.TTF

Lucida Console (TrueType) = LUCON.TTF

Marlett (TrueType) = MARLETT.TTF

Tahoma = TAHOMA.TTF

Tahoma 粗体 (TrueType) = TAHOMABD.TTF

Times New Roman (TrueType) = TIMES.TTF

Times New Roman 粗体 (TrueType) = TIMESBD.TTF

Times New Roman 粗斜体 (TrueType) = TIMESBI.TTF

Times New Roman 斜体 (TrueType) = TIMESI.TTF

Modern (Plotter) = MODERN.FON

Comic Sans MS 粗体 (TrueType) = COMICBD.TTF

Verdana 粗体 (TrueType) = VERDANAB.TTF

Verdana 斜体 (TrueType) = VERDANAI.TTF

Verdana 粗斜体 (TrueType) = VERDANAZ.TTF

Basemic (TrueType) = BASEMIC_.TTF

Basemic Symbol (TrueType) = BASES___.TTF

Basemic Times (TrueType) = BASET___.TTF

Kingsoft Phonetic (TrueType) = Ksphonet.ttf

SerialNumber = dword:000b6bbc

MingLiU & PMingLiU (TrueType) = MINGLIU.TTC

方正舒体 (TrueType) = FZSTK.TTF

方正姚体 (TrueType) = FZYTK.TTF

隶书 (TrueType) = SIMLI.TTF

华文彩云 (TrueType) = STCAIYUN.TTF

华文细黑 (TrueType) = STXIHEI.TTF

华文行楷 (TrueType) = STXINGKA.TTF

华文新魏 (TrueType) = STXINWEI.TTF

华文中宋 (TrueType) = STZHONGS.TTF

幼圆 (TrueType) = SIMYOU.TTF

Arial Black (TrueType) = ARIBLK.TTF

Arial Narrow (TrueType) = ARIALN.TTF

Book Antiqua (TrueType) = BKANT.TTF

Bookman Old Style (TrueType) = BOOKOS.TTF

Century Gothic (TrueType) = GOTHIC.TTF

Comic Sans MS (TrueType) = COMIC.TTF

Courier New (TrueType) = COUR.TTF

Garamond (TrueType) = GARA.TTF

Haettenschweiler (TrueType) = HATTEN.TTF

Impact (TrueType) = IMPACT.TTF

Monotype Corsiva (TrueType) = MTCORSVA.TTF

MS Outlook (TrueType) = Outlook.TTF

Symbol (TrueType) = SYMBOL.TTF

Trebuchet MS (TrueType) = TREBUC.TTF

Verdana (TrueType) = VERDANA.TTF

Wingdings (TrueType) = WINGDING.TTF

Wingdings 2 (TrueType) = WINGDNG2.TTF

Wingdings 3 (TrueType) = WINGDNG3.TTF

Book Antiqua Bold (TrueType) = ANTQUAB.TTF

Book Antiqua Bold Italic (TrueType) = ANTQUABI.TTF

Book Antiqua Italic (TrueType) = ANTQUAI.TTF

Arial Black Italic (TrueType) = ARBLI___.TTF

Arial Bold (TrueType) = ARIALBD.TTF

Arial Bold Italic (TrueType) = ARIALBI.TTF

Arial Italic (TrueType) = ARIALI.TTF

Arial Narrow Bold (TrueType) = ARIALNB.TTF

Arial Narrow Bold Italic (TrueType) = ARIALNBI.TTF

Arial Narrow Italic (TrueType) = ARIALNI.TTF

Bookman Old Style Bold (TrueType) = BOOKOSB.TTF

Bookman Old Style Bold Italic (TrueType) = BOOKOSBI.TTF

Bookman Old Style Italic (TrueType) = BOOKOSI.TTF

Comic Sans MS Bold (TrueType) = COMICBD.TTF

Courier New Bold (TrueType) = COURBD.TTF

Courier New Bold Italic (TrueType) = COURBI.TTF

Courier New Italic (TrueType) = COURI.TTF

Garamond Bold (TrueType) = GARABD.TTF

Garamond Italic (TrueType) = GARAIT.TTF

Century Gothic Bold (TrueType) = GOTHICB.TTF

Century Gothic Bold Italic (TrueType) = GOTHICBI.TTF

Century Gothic Italic (TrueType) = GOTHICI.TTF

Tahoma (TrueType) = TAHOMA.TTF

Tahoma Bold (TrueType) = TAHOMABD.TTF

Times New Roman Bold (TrueType) = TIMESBD.TTF

Times New Roman Bold Italic (TrueType) = TIMESBI.TTF

Times New Roman Italic (TrueType) = TIMESI.TTF

Trebuchet MS Bold (TrueType) = TREBUCBD.TTF

Trebuchet MS Bold Italic (TrueType) = TREBUCBI.TTF

Trebuchet MS Italic (TrueType) = TREBUCIT.TTF

Verdana Bold (TrueType) = VERDANAB.TTF

Verdana Italic (TrueType) = VERDANAI.TTF

Verdana Bold Italic (TrueType) = VERDANAZ.TTF

Webdings (TrueType) = WEBDINGS.TTF

Tahoma (True Type) = tahoma.ttf 

OutputStream os = new FileOutputStream(outputFile);
		ITextRenderer renderer = new ITextRenderer();

		String content = openFile(inputFile);

		StringBuffer bf = new StringBuffer();
		bf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		bf.append(content);
		renderer.setDocumentFromString(content);
		// 必须有对应的字体 解决中文支持问题
		ITextFontResolver fontResolver = renderer.getFontResolver();
		fontResolver.addFont("C:/Windows/Fonts/SIMSUN.TTC", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
		// font-family:'Arial Unicode MS'"
		fontResolver.addFont("C:/Windows/Fonts/ARIALUNI.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); 
		fontResolver.addFont("C:/Windows/Fonts/SIMYOU.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
		fontResolver.flushFontFaceFonts();

		// 解决图片的相对路径问题
		renderer.getSharedContext().setBaseURL("file:/D:/");

		renderer.layout();
		renderer.createPDF(os);
		os.flush();
		os.close();

		return true;


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大巨魔战将

如果对您有帮助,请打赏1分钱

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值