How to convert my form into PDF by using Python

1.2k views Asked by At

I created some forms using WTForms and of course html. How can I convert into PDF by using Python ? For example the form below , for the submit button on the form , I want to add a method using python to download those data into pdf format.

<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>

Can anybody help me? Thanks.

0

There are 0 answers