日期:2014-05-17 浏览次数:20673 次
plumbing.render INFO:: Using CSS implementation from: org.xhtmlrenderer.context.StyleReference plumbing.exception WARNING:: Unhandled exception. tables org.xhtmlrenderer.util.XRRuntimeException: tables at org.xhtmlrenderer.pdf.ITextFontResolver.addFont(ITextFontResolver.java:96) at test.byd.com.dcc.unittest.TestPdf.main(TestPdf.java:114) Caused by: java.lang.NoSuchFieldException: tables at java.lang.Class.getDeclaredField(Unknown Source) at org.xhtmlrenderer.pdf.TrueTypeUtil.extractTables(TrueTypeUtil.java:66) at org.xhtmlrenderer.pdf.TrueTypeUtil.populateDescription(TrueTypeUtil.java:77) at org.xhtmlrenderer.pdf.ITextFontResolver.addFont(ITextFontResolver.java:94) ... 1 more plumbing.load INFO:: TIME: parse stylesheets 140ms plumbing.match INFO:: media = print plumbing.match INFO:: Matcher created with 119 selectors plumbing.exception WARNING:: IO problem for file:/public/global/images/byd_logo.png
private static Cell newCell(String str,int align,Color color){ Cell cell=null; try { cell = new Cell(new Paragraph(str,setChineseFont())); cell.setHorizontalAlignment(align); cell.setUseAscender(false); cell.setVerticalAlignment(Element.ALIGN_CENTER);//上下居中 cell.setBackgroundColor(color); //cell.setBorderWidth(1); } catch (BadElementException e) { e.printStackTrace(); } return cell; } /** * 设置中文 * @author maHai * @return Font */ private static Font setChineseFont() { BaseFont base = null; Font fontChinese = null; try { base = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.EMBEDDED); fontChinese = new Font(base, 12, Font.NORMAL); } catch (DocumentException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return fontChinese; }
------解决方案--------------------
以前做练习的时候和LZ遇到过同样的问题,
后来就没有继续下去了!!