Search code examples
javaitextvelocitytemplate-engine

How to use border-radius while converting html to pdf using itextpdf


I am trying to round the corners of my table, border-radius doen't seem to work when I convert the below HTML to PDF using Itext pdf generator. Below is the HTML written for table:

<table style="border-radius:20px; border:1px solid">
        <tbody>
            <tr>
            <td style="padding-left: 16px; padding-top: 11px;  padding-bottom: 11px;border: 1px solid #909090; -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius:20px;">
            <div>
            <p >$text1
            </p>
            </div>
            </td>
            <td style="padding-left: 16px; padding-top: 11px;  padding-bottom: 11px; border-right: 1px solid #909090;">
            <div>
            <p > $text2
            </p>
            </div>
            </td>
            <td style="padding-left: 16px; padding-top: 11px;  padding-bottom: 11px;">
            <div>
            <p>$text3
            </p>
            </div>
            </td>
            </tr>
        </tbody>
    </table>

ITEXT PDF CODE:

XMLWorkerHelper xmlWorkerHelper = XMLWorkerHelper.getInstance();
            xmlWorkerHelper.getDefaultCssResolver(true);
            xmlWorkerHelper.parseXHtml(pdfWriter, document, new StringReader(template));

Solution

  • I was using Itext5 , After upgrading to Itext7, border-radius property started working