用renderer.setDocumentFromString(html.toString()); ,传进去html,会报错,
<img>必须用</img>结尾,原本是<img />,可是我改成</img>结尾,还是会报这个错,这是为什么啊,去掉图片就能正常生成pdf,加上就不行
Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1187; 元素类型 "img" 必\须由匹配的结束标记 "" 终止。
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
at org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLResource.java:189)
... 98 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1187; 元素类型 "img" 必须由匹配的结束标记 "" 终止。
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(Unknown Source)
... 101 more