消息关闭
    暂无新消息!
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1021; Element type "null" must be followed by either attribute specifications, ">" or "/>".
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
... 46 more

3个回答

︿ 1
 public void createRtfContext(String pic, OutputStream out,String html) {
     System.out.println("pic==="+pic);
     ITextRenderer render = new ITextRenderer();
     StringBuffer buffer = new StringBuffer();
     buffer.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");       
     buffer.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">")
     .append("<head>")       
.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />")     
.append("<style type=\"text/css\" mce_bogus=\"1\">body {font-family: SimSun;font-size: 75%}."
+"tableStyle {width: 96%;margin-top: 15px;border-collapse: collapse;border: 1px solid #c5dbf0;"
+"background-color: white}th {border-left: 1.0pt solid windowtext;border-right: 1.0pt solid windowtext;"
+"border-bottom: 1.0pt solid windowtext;word-wrap: normal;word-break: keep-all;overflow: hidden;"
+"border-color: #c5dbf0;height: 32px;padding: 0 2px 0 4px;color: #000000;"
+"background-image: url(table/th_bg.jpg);background-repeat: repeat-x;"
+"font-weight: normal;line-height: 32px;font-weight: bold;}"
+"tr.odd {background: #f4f7fa;}tr {color: #333333;border: 1px solid #c5dbf0;}"
+"td {color: #333333;border: 1px solid #c5dbf0;}"
+"th {color: #333333;border: 1px solid #c5dbf0;}</style>")  
.append("</head>")       
.append("<body>");
     buffer.append("<table id='myTable' width='100%'border='0'align='center'cellpadding='0'"
     +"cellspacing='0' class='tableStyle'>");
//     buffer.append(html);
     buffer.append("</table>");
//     buffer.append("<div style='margin:0 auto;'><img src='/jsp/teacher/examscore/upload/pic/1.jpg'/></div>");
     buffer.append("</body></html>");  
     System.out.println("buffer>>>"+buffer);
     render.setDocumentFromString(buffer.toString());
     ITextFontResolver fontResolver = render.getFontResolver();

try {
fontResolver.addFont("C:/WINDOWS/Fonts/SimSun.ttc",BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);// 宋体字
fontResolver.addFont("C:/WINDOWS/Fonts/Arial.ttf",BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);// 宋体字
render.layout();
     render.createPDF(out);
} catch (DocumentException | IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

    求哪位大神给看看,上面那是什么错