diff --git a/app.py b/app.py index 7b6ffa0..e6b57e7 100644 --- a/app.py +++ b/app.py @@ -296,16 +296,23 @@ def generate_pdf_custom(): 'ts2': (TS2_HEIGHT, TS2_WIDTH), 'popper': (POPPER_HEIGHT, POPPER_WIDTH), }[target_type] + target_height=scale * original_target_height + target_width=scale * original_target_width + if (size == 'a4' and target_width > 21) or (size == 'a3' and target_width > 29.7): + oversized = True + else: + oversized = False rendered_html = render_template( 'pdf_template_custom.html', distance=distance, size=size, - target_height=scale * original_target_height, - target_width=scale * original_target_width, + target_height=target_height, + target_width=target_width, gap=scale * IPSC_GAP + scale * original_target_width, target_type=target_type, - simulated_distance=simulated_distance + simulated_distance=simulated_distance, + oversized=oversized ) # return rendered_html diff --git a/static/images/shootoff.webp b/static/images/shootoff.webp index 4d01bb0..4aa2e08 100644 Binary files a/static/images/shootoff.webp and b/static/images/shootoff.webp differ diff --git a/templates/pdf_template_custom.html b/templates/pdf_template_custom.html index 4925181..97b1e9f 100644 --- a/templates/pdf_template_custom.html +++ b/templates/pdf_template_custom.html @@ -30,6 +30,16 @@ left: 0; right: 0; } + .content-oversized { + position: relative; + height: {{target_height}}cm; /* Paper height */ + overflow: hidden; /* Hide overflow on both sides */ + } + .content-oversized svg { + position: absolute; + left: 50%; /* Move to the center */ + transform: translateX(-50%); /* Center the SVG horizontally */ + } .mounting-point { height: 10mm; @@ -44,6 +54,17 @@ text-align: center; } + .mounting-info-oversized { + font-size: xx-small; + color: #ccc; + text-align: center; + position: absolute; + z-index: 111; + bottom: 1.5cm; + left: 50%; + transform: translateX(-50%); + } + .preview { display: block; border-bottom: solid 1px black; @@ -61,7 +82,7 @@
-
+
{% with target_width=target_width, target_height=target_height %} {% if target_type == 'ipsc' %} {%include 'ipsc_svg.html'%} @@ -74,7 +95,7 @@ {% endif%} {% endwith %}
-
+
{%trans%}Target{%endtrans%}: {{ target_type|upper }} | {%trans%}Simulated distance{%endtrans%}: {{ simulated_distance }}m | {%trans%}Place target on{%endtrans%}: {{distance}}m
Steel Training diff --git a/templates/pdf_template_shootoff.html b/templates/pdf_template_shootoff.html index dac4a18..2f2d199 100644 --- a/templates/pdf_template_shootoff.html +++ b/templates/pdf_template_shootoff.html @@ -66,6 +66,7 @@ border-top: solid 1px black; width: 100%; height: 75mm; + text-align: center; } .preview-post { @@ -82,31 +83,18 @@
{% for i in range(target_count) %} - {% if i == target_count-1 %} -
-
- -
+
+ {% if i == target_count-1 %} + {% with target_width=preview_scale * 30, target_height=preview_scale * 85 %} + {% include 'popper_svg.html' %} + {% endwith %} + {% else %} + {% with target_width=preview_scale * 20, target_height=preview_scale * 56 %} + {% include 'popper_svg.html' %} + {% endwith %} + {% endif %}
- {% else %} -
-
- -
-
- {% endif %} + {% endfor %}

{%trans%}Wall length required{%endtrans%}: {{ wall_length|round(1,'ceil') }}cm

@@ -124,32 +112,13 @@
{% if i == target_count-1 %} - -
-
- -
-
+ {% with target_width=scale * 30, target_height=scale * 85 %} + {% include 'popper_svg.html' %} + {% endwith %} {% else %} -
-
- -
-
- + {% with target_width=scale * 20, target_height=scale * 56 %} + {% include 'popper_svg.html' %} + {% endwith %} {% endif %} {% if i==0 %}
{%trans%}ZERO point{%endtrans%} (Shootoff)