Browse Source

DIV-1198 - Blank pages in PDFs

pull/172/head
Michael Olund 5 years ago
parent
commit
68990cdf2e
2 changed files with 1 additions and 17 deletions
  1. +1
    -1
      edivorce/apps/core/templates/pdf/images_to_pdf.html
  2. +0
    -16
      edivorce/apps/core/templatetags/format_utils.py

+ 1
- 1
edivorce/apps/core/templates/pdf/images_to_pdf.html View File

@ -29,7 +29,7 @@
<body> <body>
<div class="print-wrapper"> <div class="print-wrapper">
{% for image in images %} {% for image in images %}
<img src="{{ image_root }}/api/documents/{{ image.file }}/{{ image.rotation }}/" style="{{ image|css_rotate }}">
<img src="{{ image_root }}/api/documents/{{ image.file }}/{{ image.rotation }}/" style="max-width: 100%; max-height: 26.9cm;">
{% if not forloop.last %} {% if not forloop.last %}
<p style="page-break-before: always" ></p> <p style="page-break-before: always" ></p>
{% endif %} {% endif %}


+ 0
- 16
edivorce/apps/core/templatetags/format_utils.py View File

@ -193,22 +193,6 @@ def agreed_child_support_amount(context, claimant_id, line_breaks=True):
return linebreaksli(context.get('amount_income_over_high_income_limit_{}'.format(claimant_id), '')) return linebreaksli(context.get('amount_income_over_high_income_limit_{}'.format(claimant_id), ''))
@register.filter
def css_rotate(image):
""" Gets extra CSS needed for image rotation when generating PDFs """
if image.rotation == 90 or image.rotation == 270:
height = image.width
width = image.height
else:
height = image.height
width = image.width
if width == 0 or height/width < 1.3:
return 'width: 100%'
else:
return 'height: 26.7cm'
@register.filter @register.filter
def name_you(responses): def name_you(responses):
""" Gets and formats given_name_1_you, given_name_2_you, given_name_3_you, last_name_you from responses """ """ Gets and formats given_name_1_you, given_name_2_you, given_name_3_you, last_name_you from responses """


Loading…
Cancel
Save