英文:
How to use border-radius while converting html to pdf using itextpdf
问题
<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>
XMLWorkerHelper xmlWorkerHelper = XMLWorkerHelper.getInstance();
xmlWorkerHelper.getDefaultCssResolver(true);
xmlWorkerHelper.parseXHtml(pdfWriter, document, new StringReader(template));
英文:
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));
答案1
得分: 2
我之前在使用Itext5,升级到Itext7后,border-radius属性开始起效。
英文:
I was using Itext5 , After upgrading to Itext7, border-radius property started working
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论