java - itext pdf generation fail on parsing some html tags -
i have html code, reside in db , want parse in pdf. using itext pdf generation. here html in db:
<p>no note.</p><br> <ul><br> <li><strong>section</strong></li><br> </ul><br> <ol><br> <li>first</li><br> <li><em>second</em></li><br> <li><span style="text-decoration: underline;">third</span></li><br> </ol><br>
and here parsed , inserted pdf:
<p>no note.</p><br> <strong>section</strong><br> first<br> <em>second</em><br> <span style="text-decoration: underline;">third</span><br>
and here code parse html pdf:
org.jsoup.nodes.document doc = jsoup.parse(text); list<element> objects; objects = htmlworker.parsetolist(new stringreader(doc.outerhtml()), null); (element object : objects) { element ele = (element) object; document.add(ele); }
as can seen numbers , bullet not shown (which "ol" , "li" tags in html). how solve this?
edit
for more clarification. here text have in html:
and here note inserted pdf:
my friend solved it:
xmlworkerhelper.getinstance().parsexhtml(new xhtmlelementhandler(document), new stringreader(text));
simple :)
Comments
Post a Comment