问题描述
我正在尝试绕过桌子的角,当我使用 xhtmltopdf pdf 生成器将下面的 HTML 转换为 PDF 时,border-radius 似乎不起作用。下面是为内容文件名是sticker_print.html编写的HTML:
<div class="sticker" style="height:196px">
<table class="sticker_Box" align="left">
<tr>
<td style="border: 1px solid #222;background-color: #ffffff;">
<h3 style="border-bottom: 1px solid #222222;">Batch Sticker</h3>
<h5 style="padding: 0 0 0 10px;">Batch ID</h5>
<p>MFG Date</p>
<p style="padding-bottom:0px;"><img src="http://www.computalabel.com/Images/[email protected]" width="195px" height="26px"><span> Bar Code </span></p>
<p style="text-align: left; padding-bottom: 0px;">
<img src="https://www.kaspersky.com/content/en-global/images/repository/isc/2020/9910/a-guide-to-qr-codes-and-how-to-scan-qr-codes-2.png" width="65px" height="65px">
<span style="display: block;margin-top: 0px;">QR Code</span>
</p>
</td>
</tr>
</table>
</div>
PDF 代码
pdf = render_to_pdf('sticker_print.html')
return HttpResponse(pdf,content_type='application/pdf')
解决方法
即使我没有使用与您相同的 PDF 引擎(并且您的问题已有 6 个月大),我还是通过在表格单元格或 div 上使用 model.train()
而不是 corner-radius
解决了这个问题.