iText 7 HTML to PDF conversion [duplicate]

2019-02-27 21:08发布

This question already has an answer here:

I am using iText 7 for PDF generation.I need to append Rich Text which having HTML document. In itext 5, i was using Chunk class for extracting data. But in itext 7 I don't see any API.

And I tried with the code

HtmlConverter.convertToPdf(is, os, properties);

But it is giving below error.

Exception in thread "main" java.lang.NoSuchMethodError: com.itextpdf.layout.font.FontSet.getFonts()Ljava/util/Set;
at com.itextpdf.html2pdf.attach.impl.DefaultHtmlProcessor.processDocument(DefaultHtmlProcessor.java:107)
at com.itextpdf.html2pdf.attach.Attacher.attach(Attacher.java:18)
at com.itextpdf.html2pdf.HtmlConverter.convertToDocument(HtmlConverter.java:108)
at com.itextpdf.html2pdf.HtmlConverter.convertToPdf(HtmlConverter.java:85)
at com.itextpdf.html2pdf.HtmlConverter.convertToPdf(HtmlConverter.java:81)
at com.itextpdf.html2pdf.HtmlConverter.convertToPdf(HtmlConverter.java:69)
at com.itextpdf.html2pdf.HtmlConverter.convertToPdf(HtmlConverter.java:65)

1条回答
爷的心禁止访问
2楼-- · 2019-02-27 21:58

After updating versions to 7.0.3 and 1.0.0, issue is resolved.

查看更多
登录 后发表回答