pisa pdf generation - текст только для первой страницы - PullRequest
2 голосов
/ 09 марта 2012

Я хочу создавать письма с помощью pisa (& django python).Мне нужно, чтобы адрес компании отображался на первой странице, а не на последующих.Я не могу понять, как это сделать, и это сводит меня с ума (на Пизе не так много документации.

Также я хотел бы иметь возможность использовать фреймы, не делая контент статичным (как с атрибутом -pdf-frame-content css).

В настоящее время у меня появляется логотип сверху и снизу, а мой текст выглядит нормально, я просто пытаюсь реально контролировать, где он появляется.1005 *

<!DOCTYPE HTML>
<html>
    <head>
       <title>Patient Acceptance</title>
       <style type="text/css">
           @page {
               size:  {{ pagesize }};
               margin-top: 3.5cm;
               margin-left: 2.5cm;
               margin-bottom: 4cm;
               margin-right: 2cm;
               @frame footer {
                   -pdf-frame-content: pdf_footer_content;
                   bottom: 0cm;
                   margin-left: 2cm;
                   margin-right: 0.5cm;
                   height: 3cm;
               }
               @frame blar_logo {
                   -pdf-frame-content: pdf_blar_logo;
                   top: 0.5cm;
                   margin-left: 2cm;
                   margin-right: 15cm;
                   height:3cm;
               }
           }
           .blar_address {
                   top: 0cm;
                   margin-left: 13cm;
                   margin-right: 0cm;
                   height:4cm;
               }
           .institution_address {
                   top: 0.9cm;
                   margin-left: 0cm;
                   width: 10cm;
                   height:4cm;
               }
       </style>
    </head>
    <body>
       <div id = "pdf_logo">
           <img alt="study logo" src="/media/images/logo_for_letters2.jpg"/>
       </div>
       <div class="blar_address">
           Central Monitoring Office</br>
           Castle Hospital</br>
           Castle Road</br>
           Brendam</br>
           East Binkleshire, BK2 3LK</br>
       </div>
       <div class="institution_address">
        {{ gp.gp_title }} {{ gp.gp_firstname }} {{ gp.gp_surname }}</br>
        {{ gp.practice_id.practice_name }} </br>
        {{ gp.practice_id.address_1 }} </br>
        {% if gp.practice_id.address_2 %}
            {{ gp.practice_id.address_2 }} </br>
        {% endif %}
        {% if gp.practice_id.address_3 %}
            {{ gp.practice_id.address_3 }} </br>
        {% endif %}
        {% if gp.practice_id.address_4 %}
            {{ gp.practice_id.address_4 }} </br>
        {% endif %}
        {% if gp.practice_id.town_city %}
            {{ gp.practice_id.town_city }} </br>
        {% endif %}
        {% if gp.practice_id.post_code %}
            {{ gp.practice_id.post_code }} </br>
        {% endif %}
       </div>
       <p> {{ date }} </p>
       <p>Please file this letter and a copy of the patient&#39s informed consent in the patient&#39s case records</p>
       <p>Dear {{ gp.gp_title }} {{ gp.gp_surname }},</p>
       <p>I am writing to inform you that your patient {{ patient.patient_title }} {{ patient.patient_firstname }} {{ patient.patient_surname }}, {{ patient.address_1}}
        {% if patient.address_2 %}
            , {{ patient.address_2 }}
        {% endif %}
        {% if patient.address_3 %}
            , {{ patient.address_3 }}
        {% endif %}
        {% if patient.address_4 %}
            , {{ patient.address_4 }}
        {% endif %}
        {% if patient.town_city %}
            , {{ patient.town_city }}
        {% endif %}
        {% if patient.post_code %}
            , {{ patient.postcode }}
        {% endif %}
       , has volunteered to participate in a clinical trial entitled Blar</p>
       <p>This patient has been assigned to   
       {% if patient.cora = 'C' %}
            blar
       {% else %}
            blar
       {% endif %}                         
       <p>This is a randomised controlled trial funded by the NHS comparing blar and blar
       <p>Should you have any questions or concerns, please contact the central monitoring office on 01815 654864.</p>
       <p>Yours sincerely,</p>
       </br>
       </br>
       <p>Professor Blar</p>
       <div>
       </div>

       <div id="pdf_footer_content">
           <img alt="Bniklle NHS Logo" src="/media/images/blar_nhs_logo_for_letters2.jpg"/>
           <img alt="University of Bunkum Logo" src="/media/images/uni_blar_logo_for_letters2.jpg"/>
       </div>
    </body>
</html>
...