首页>代码>使用jfreechart和itext实现导出报表和表格到pdf文档>/PdDFExportDemo/src/com/ptengine/web/datacenter/csv/ReportFontFactory.java
package com.ptengine.web.datacenter.csv;

import java.io.IOException;

import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.pdf.BaseFont;

public class ReportFontFactory {
	public enum Font_Type{
		TITLE,HEADER,CONTENT;
    }
	
	private ReportFontFactory(){}
	
	/**
	 * Function 创建PDF报表字体
	 * CreateTime 2010年7月8日
	 * @author li
	 * @param fontType 字体类型(enum)
	 * @return Font 字体
	 * @throws DocumentException
	 * @throws IOException
	 */
	public  static Font getFontChinese(Font_Type fontType) throws DocumentException, IOException{
		BaseFont bfChinese = BaseFont.createFont("c:\\windows\\fonts\\simsun.ttc,1", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
		com.itextpdf.text.Font fontChinese=null;
		switch (fontType){
		   case TITLE:
			   fontChinese= new com.itextpdf.text.Font(bfChinese,12, com.itextpdf.text.Font.NORMAL);
			   break;
		   case HEADER:
			   fontChinese = new com.itextpdf.text.Font(bfChinese,10, com.itextpdf.text.Font.NORMAL);
			   break;
		   case CONTENT:
			   fontChinese = new com.itextpdf.text.Font(bfChinese,8, com.itextpdf.text.Font.NORMAL);
			   break;
		   default:	  
			   fontChinese = new com.itextpdf.text.Font(bfChinese,8, com.itextpdf.text.Font.NORMAL);
		       break;
			   
		}
        return fontChinese;
	}
}
最近下载更多
xxy007  LV1 2020年10月18日
sureivv  LV2 2020年6月11日
yaosiming  LV8 2020年4月14日
chinavbao  LV2 2020年3月2日
sssssssyy  LV10 2019年9月27日
yaoyahui  LV7 2019年6月28日
皮皮虾一月  LV8 2019年4月25日
zh11332  LV11 2019年3月5日
xiaomiao520  LV12 2018年10月10日
2359923694  LV2 2018年8月31日
最近浏览更多
fesfefe  LV13 2023年11月1日
1529860026  LV24 2023年7月6日
潇靓84 2023年4月14日
暂无贡献等级
东北人  LV12 2022年9月20日
543539666  LV7 2022年3月3日
来恬爸爸晋亚阳  LV3 2021年10月29日
陈永智 2021年10月8日
暂无贡献等级
dfaghrs  LV19 2021年9月21日
安安an  LV17 2021年9月10日
xsp990218  LV5 2021年8月16日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友