【问题标题】:How to use border-radius while converting html to pdf using xhtmltopdf如何在使用 xhtmltopdf 将 html 转换为 pdf 时使用边框半径
【发布时间】:2021-04-09 13:51:23
【问题描述】:

我试图绕过我的桌子的角落,当我使用 xhtmltopdf pdf 生成器将下面的 HTML 转换为 PDF 时,边框半径似乎不起作用。下面是为内容文件名而编写的 HTML 是sticker_print.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/C128ff@2x.png" 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')

【问题讨论】:

    标签: python html django-templates xhtml2pdf


    【解决方案1】:

    即使我没有使用与您相同的 PDF 引擎(而且您的问题是 6 个月大),我通过在表格单元格或 div 上使用 corner-radius 而不是 border-radius 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-20
      • 1970-01-01
      • 2011-07-08
      • 2014-09-29
      • 2010-12-29
      相关资源
      最近更新 更多