HTML String is not parsed with iText XML parser

2019-09-20 05:29发布

I am unable to parse below HTML string using iText's xmlworker-5.5.9.jar

String FOOTER = "<table width=\"100%\" border=\"0\"><tr><td><span class=\"bold\">Footer</span></td><td align=\"right\">Some title</td></tr></table>";

by below helper class:

XMLWorkerHelper.parseToElementList(FOOTER, CSS);

I am getting below error:

Exception in thread "main" java.lang.NoSuchMethodError: com.itextpdf.tool.xml.html.pdfelement.NoNewLineParagraph.setMultipliedLeading(F)V

I saw iText's documentatin and answer in this forum too.

Any help will be appreciated. Thanks.

1条回答
\"骚年 ilove
2楼-- · 2019-09-20 06:07

The above exception is beacause of uncompatibility of xmlWorker.jar and itextpdf.jar. So, to avoid above exception use single itextpdf.jar in your project and that is above itextpdf-5.5.1.jar version.

查看更多
登录 后发表回答