加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

java – RuntimeWorkerException:找到无效的嵌套标记头,预期

发布时间:2020-12-14 23:16:43 所属栏目:资源 来源:网络整理
导读:我正在使用iText将html转换为pdf,但我不断在parseXHtml中抛出RuntimeWorkerException.这是我的代码: Document tempDoc = new Document();PdfWriter pdfWriter = PdfWriter.getInstance(tempDoc,out);tempDoc.open();XMLWorkerHelper.getInstance().parseXHt

我正在使用iText将html转换为pdf,但我不断在parseXHtml中抛出RuntimeWorkerException.这是我的代码:

Document tempDoc = new Document();
PdfWriter pdfWriter = PdfWriter.getInstance(tempDoc,out);
tempDoc.open();
XMLWorkerHelper.getInstance().parseXHtml(pdfWriter,tempDoc,new ByteArrayInputStream(html.getBytes()));
tempDoc.close();

我不太熟悉HTML和XHTML之间的差异,所以我对如何处理这个问题感到有些不知所措. Here’s the html source if it helps.

最佳答案
错误信息很清楚,你有一个< meta>未关闭的标头中的标签在HTML中有效但不是XHTML,而您正在将其解析为.你需要关闭那些,< meta ... />

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读