如何使用Python将我的表单转换为PDF

时间:2015-06-18 13:54:36

标签: python html flask-wtforms

我使用WTForms创建了一些表单,当然还有html。如何使用Python转换为PDF? 例如下面的表单,对于表单上的提交按钮,我想使用python添加一个方法将这些数据下载为pdf格式。

<div class="container" align="center" style="padding-top:15px;">
    <form action=" " method="POST" >
        <input type="hidden"  name="id_patient" id="id_patient" value="{{ doc_patient._id}}">
        <button type="submit">Download</button> </form>
        <section>
            <br>
            <h3 style="padding-left:50px;"> Patient Form</h3><br>

            <table class="patient-view-table">
                <tr>
                    <td class="property-name-col">Name:</td>
                    <td class="property-value-col">{{ patient_doc.name }}</td>
                </tr>
                <tr>
                    <td class="property-name-col">Surname:</td>
                    <td class="property-value-col">{{ patient_doc.surname }}</td>
                </tr>
                <tr>
                    <td class="property-name-col">Sex:</td>
                    <td class="property-value-col">{{ patient_doc.sex }}</td>
                </tr>
                <tr>
                    <td class="property-name-col">Personal number:</td>
                    <td class="property-value-col">{{ patient_doc.personal_number }}</td>
                </tr>
                <tr>
                    <td class="property-name-col">Date of birth:</td>
                    <td class="property-value-col">{{ patient_doc.birthday }}</td>
                </tr>
                <tr>
                    <td class="property-name-col">Address:</td>
                    <td class="property-value-col">{{ patient_doc.address }}</td>
                </tr>
            </section>
        </table>
</div>

任何人都可以帮助我吗?感谢。

0 个答案:

没有答案
相关问题