ITextRenderer - value attribute <li> is ignored

I am using ITextRenderer to create an HTML file in a PDF file in my Java application. Its work is good and that’s all, except we found a problem in some of our PDF files. I found only one link on the Internet, and also here on the stack ( itext-xmlworkerhelper-ignores-value-attribute-of-li-tag )

Can anybody help? The problem is exactly the same as in the provided link.

I want to change the API to make this work if someone suggests another one that will definitely work ...

Thanks!

Here is the code to create it:

    org.xhtmlrenderer.pdf.ITextRenderer renderer = new org.xhtmlrenderer.pdf.ITextRenderer();
    renderer.setDocumentFromString(strHhtml);
    renderer.layout();
    renderer.createPDF(out);
    renderer.finishPDF();

Where strHtml is the html content:

<ol style="list-style-type: lower-alpha">
     <li>aaaa</li>
     <li>bbbbbbb</li>
</ol>
<p style="margin-left: 42.55pt"><strong>Note:</strong> simple paragraph</p>
<ol style="list-style-type: lower-alpha">
     <li value="3">ccccc</li>
     <li value="4">bbbbbb</li>
</ol>
+4
source share

Source: https://habr.com/ru/post/1613660/


All Articles