如题,由于是通过jacob转的html,使用xmlworker,Flying Sauser都各种类似“'与元素类型 "link" 相关联的属性 "rel" 应有左引号。'”的不停报错,使用itext无法识别中文,而且图片路径不知道怎么设置,每次都默认在我D盘根目录找。
以下是通过itext转换的java代码,是否能修改后完成中文和图片路径的处理呢:
public static void main(String[] args) throws Exception {
Document document = new Document();
StyleSheet st = new StyleSheet();
st.loadTagStyle("body", "leading", "16,0");
PdfWriter.getInstance(document, new FileOutputStream("C:\Users\Administrator\Desktop\123.pdf"));
document.open();
List p = HTMLWorker.parseToList(new FileReader("C:\Users\Administrator\Desktop\123.html"), st);
for (int k = 0; k < p.size(); ++k)
document.add((Element) p.get(k));
System.out.println("complete");
document.close();
}
以下是jacob转的html的前面部分,有什么好的办法让xmlworker,Flying Sauser能识别jacob转的文件,或者让jacob转的html变得“规范”呢。
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40">
<!--[if !mso]>