如何删除 PDF 中网络表单的标题和提交编号?

发布于 2025-01-12 19:56:26 字数 3715 浏览 1 评论 0原文

我正在使用 twig 在 PDF 附件< 中显示表单提交的所有数据/a> 字段。编写 twig 代码后,

  1. 表单的标题和提交 ID 不会消失并弄乱模板,而且我什至没有将它们放在 twig 上。

  2. 尽管我的代码在编辑器中运行良好,但日期和 p 标记未正确打印

谁能告诉我为什么以及如何解决该问题?

 <style>
    .wrap {
        text-align: center;
    }

    #signature {
        display: inline-table;
        border-collapse: collapse;
        table-layout: auto;
        border: 1px solid rgba(5, 138, 222, 0.67);
        empty-cells: show;
        margin: 1%;
        table-layout: auto;
    }

    #sign {
        border: 1px solid rgba(5, 138, 222, 0.67);
        padding: 10px;
    }

    th {
        background-color: rgba(143, 220, 242, 0.67);
        border: 1px solid rgba(5, 138, 222, 0.67);
        border-left: 1px solid rgba(5, 138, 222, 0.67);
        border-bottom: 1px solid rgba(5, 138, 222, 0.67);
        color: #000000;
        text-align: center;
        font-weight: bold;
        vertical-align: middle;
        padding: .75em .5em;

    }

    td {
        text-align: right;
        border: 1px solid rgba(5, 138, 222, 0.67);
        vertical-align: middle;
        padding: .75em .5em;
    }

    #item {
        border-collapse: collapse;
        border: 1px solid rgba(5, 138, 222, 0.67);
        empty-cells: show;
        margin: 1%;
        table-layout: auto;
        width: 100%;
    }

    p {
        font-weight: bold;
    }
</style>
<body>

    <h1 style="float: right;">Date: <u>[webform_submission:values:date_]</u></h1>
    <table id="item">
        <tr>
            <th colspan="5">Expense Item</th>
        </tr>
        <tr>
            <th>Service Purchased</th>
            <th>Purpose</th>
            <th>Receipt</th>
            <th>Account Code</th>
            <th>Amount</th>
        </tr>
        {% for item in data.voucher %}
        <tr>
            <td>{{item.date}}</td>
            <td>{{item.purpose}}</td>
            <td><input type="checkbox"></td>
            <td>{{ item.acct_num }}</td>
            <td>{{'$ ' ~ item.amount}}</td>
        </tr>
        {% endfor %}

    </table>
    <br>
    <h3 align="right">Total Petty Cash: <u>[webform_submission:values:petty_cash_voucher_01_total_petty_cash]</u></h3>
    <br>

    <div class="wrap">
        <table id="signature" width="150">
            <tr>
                <th id="sign">Purchased/Received By:</th>
            </tr>
            <tr>
                <td id="sign" height="100"></td>
            </tr>
        </table>


        <table id="signature" width="150">
            <tr>
                <th id="sign">Approved By:</th>
            </tr>
            <tr>
                <td id="sign" height="100"></td>
            </tr>
        </table>

        <table id="signature" width="150">
            <tr id="sign">
                <th id="sign">Acct.Approval:</th>
            </tr>
            <tr>
                <td height="100" id="sign"></td>
            </tr>
        </table>
    </div>
    <div>
        <p>Must be approved per Authorized List.</p>
        <p>Receipts, including detailed receipts, should be attached to form.</p>
    </div>
</body>

I am using twig to display all the submitted data of a form in PDF Attachment field. After writing the twig code,

  1. the form's title and the submission ID would not go away and mess up the template, and I do not even have them on twig.

  2. the date and the p tag are not printed properly despite my code works fine in editor

Can anyone tell me why and how to fix the problem?

 <style>
    .wrap {
        text-align: center;
    }

    #signature {
        display: inline-table;
        border-collapse: collapse;
        table-layout: auto;
        border: 1px solid rgba(5, 138, 222, 0.67);
        empty-cells: show;
        margin: 1%;
        table-layout: auto;
    }

    #sign {
        border: 1px solid rgba(5, 138, 222, 0.67);
        padding: 10px;
    }

    th {
        background-color: rgba(143, 220, 242, 0.67);
        border: 1px solid rgba(5, 138, 222, 0.67);
        border-left: 1px solid rgba(5, 138, 222, 0.67);
        border-bottom: 1px solid rgba(5, 138, 222, 0.67);
        color: #000000;
        text-align: center;
        font-weight: bold;
        vertical-align: middle;
        padding: .75em .5em;

    }

    td {
        text-align: right;
        border: 1px solid rgba(5, 138, 222, 0.67);
        vertical-align: middle;
        padding: .75em .5em;
    }

    #item {
        border-collapse: collapse;
        border: 1px solid rgba(5, 138, 222, 0.67);
        empty-cells: show;
        margin: 1%;
        table-layout: auto;
        width: 100%;
    }

    p {
        font-weight: bold;
    }
</style>
<body>

    <h1 style="float: right;">Date: <u>[webform_submission:values:date_]</u></h1>
    <table id="item">
        <tr>
            <th colspan="5">Expense Item</th>
        </tr>
        <tr>
            <th>Service Purchased</th>
            <th>Purpose</th>
            <th>Receipt</th>
            <th>Account Code</th>
            <th>Amount</th>
        </tr>
        {% for item in data.voucher %}
        <tr>
            <td>{{item.date}}</td>
            <td>{{item.purpose}}</td>
            <td><input type="checkbox"></td>
            <td>{{ item.acct_num }}</td>
            <td>{{'$ ' ~ item.amount}}</td>
        </tr>
        {% endfor %}

    </table>
    <br>
    <h3 align="right">Total Petty Cash: <u>[webform_submission:values:petty_cash_voucher_01_total_petty_cash]</u></h3>
    <br>

    <div class="wrap">
        <table id="signature" width="150">
            <tr>
                <th id="sign">Purchased/Received By:</th>
            </tr>
            <tr>
                <td id="sign" height="100"></td>
            </tr>
        </table>


        <table id="signature" width="150">
            <tr>
                <th id="sign">Approved By:</th>
            </tr>
            <tr>
                <td id="sign" height="100"></td>
            </tr>
        </table>

        <table id="signature" width="150">
            <tr id="sign">
                <th id="sign">Acct.Approval:</th>
            </tr>
            <tr>
                <td height="100" id="sign"></td>
            </tr>
        </table>
    </div>
    <div>
        <p>Must be approved per Authorized List.</p>
        <p>Receipts, including detailed receipts, should be attached to form.</p>
    </div>
</body>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长梦不多时 2025-01-19 19:56:26

在您的网站中,转到Webform -> 配置 -> 表格 -> 实体打印 ->删除标题中的内容

In your site, go to Webform -> configuration -> forms -> entity print -> remove what's in the header

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文