Search code examples
jasper-reportspdf-generationindentationexport-to-pdf

Jasper Report html list alignment is not rendered good on pdf


I have an html list, it on jaspersoft studio preview is showed perfectly: enter image description here

But when I export the file from Java as a PDF (I'm using jasper ver 6.16.0), the alignment totally mess up, not even the numbers are aligned with each others: enter image description here

this is my text:

            <staticText>
                <reportElement x="33" y="30" width="517" height="270" forecolor="#010203" uuid="095f9844-3f02-4ec3-a807-0ae4a57ff5ea"/>
                <textElement textAlignment="Justified" markup="html">
                    <font fontName="DejaVu Sans Mono" size="12" isBold="false" isItalic="false"/>
                </textElement>
                <text><![CDATA[
                    <ol>
                    <li>...</li>
                    <li>...:
                    <ol>
                    <li>...</li>
                    <li>...</li>
                    <li>...</li>
                    <li>...</li>
                    </ol>
                    </li>
                    </ol>
                    ]]></text>
            </staticText>

I'm tried to use this solution but with no effect. Do you have any suggest?


Solution

  • Upgrade to JasperReports 6.19.0 or newer.

    Quoting the release notes:

    improved bulleted and numbered list support in styled text and HTML markup text fields including better indentation and support for nested lists;