java html如何转成pdf?
阿神
阿神 2017-04-17 11:18:01
0
3
818

求助一个能支持中文,支持css,支持table标签及boder和colspan属性的解决方案
尝试使用过

Document document = new Document();

PdfWriter writer = PdfWriter.getInstance(document,
    new FileOutputStream("pdf.pdf"));
document.open();
XMLWorkerHelper.getInstance().parseXHtml(writer, document,
    new FileInputStream("index.html"));
document.close();
System.out.println("PDF Created!");

使用jar包版本 itextpdf 5.4.2.jar和xmlworker.5.4.jar 不支持中文

阿神
阿神

闭关修行中......

reply all(3)
Peter_Zhu

My solution: http://swordshadow.iteye.com/blog/1983935

小葫芦

How about princexml?

Ty80

I have used itext for pdf processing before. xml worker is a library that I found on their company website that converts xml (xhtml) to pdf. You can try it.
xml worker

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template