2 u010360297 u010360297 于 2017.07.17 14:58 提问

iText将html转换成pdf文件

已经用Jsoup处理过html文件,所以htnl文件格式绝对是规范的,在windows和MacOX系统上转换都正常,但是在linux上运行转换提示出错:
RuntimeWorkerException: Invalid nested tag p found, expected closing tag span.
at com.itextpdf.tool.xml.XMLWorker.endElement(XMLWorker.java:134)
at com.itextpdf.tool.xml.parser.XMLParser.endElement(XMLParser.java:396)
at com.itextpdf.tool.xml.parser.state.ClosingTagState.process(ClosingTagState.java:70)
at com.itextpdf.tool.xml.parser.XMLParser.parseWithReader(XMLParser.java:236)
at com.itextpdf.tool.xml.parser.XMLParser.parse(XMLParser.java:214)
at com.itextpdf.tool.xml.parser.XMLParser.parse(XMLParser.java:203)
at com.itextpdf.tool.xml.XMLWorkerHelper.parseXHtml(XMLWorkerHelper.java:236)
at com.itextpdf.tool.xml.XMLWorkerHelper.parseXHtml(XMLWorkerHelper.java:210)
at com.itextpdf.tool.xml.XMLWorkerHelper.parseXHtml(XMLWorkerHelper.java:187)
at com.embraiz.util.file.DownFile.produceReport(DownFile.java:466)
at com.embraiz.controller.ReportDataController.produceReport(ReportDataController.java:628)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke
(InvocableHandlerMethod.java:219)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest
...
求解答,急~

1个回答

caozhy
caozhy   Ds   Rxr 2017.07.17 23:51

你的html文档不标准,有没有关闭的p标签,或者你获得的html文档不完整

Csdn user default icon
上传中...
上传图片
插入图片