<html lang="en">
    <head>
        <title>{{ service_name }}</title>
        <style>
            @font-face {
                font-family: NimbusSans;
                src: url({{ FONT_URIS["NimbusSans-Regular.otf"] }});
            }
            @font-face {
                font-family: NimbusSans;
                src: url({{ FONT_URIS["NimbusSans-Bold.otf"] }});
                font-weight: bold;
            }
            @page {
                size: {{ paper_width }}mm {{ paper_height }}mm;
                margin: 10mm;
            }
            body {
                font-size: 8pt;
                font-family: NimbusSans, sans-serif;
                line-height: 0;
                margin: 0;
            }
            .qrcode {
                width: {{qrcode_width}}mm;
                height: {{qrcode_width}}mm;
                background-size: contain;
                position: absolute;
                top: {{qr_code_top}}mm;
                left: 0;
                margin-left: 0.75mm;
            }
            .label {
                display: inline-block;
                position: relative;
                height: {{qrcode_width + 1.25}}mm;
                border: 0.15mm dashed black;
                padding-left: {{qrcode_width + 0.5}}mm;
                line-height: initial;
            }
            .labelText{
                display: flex;
                flex-direction: column;
                line-height: 3.325mm;
                height: 100%;
                justify-content: center;
                white-space: nowrap;
                margin: 0 1mm;
                font-weight: bold
            }
            .labelText > div {
                display: flex;
                align-items: center;
                flex-grow: 1;
            }
        </style>
    </head>
    <body>
        {% for label_index in range(num_labels) -%}
            <div class="label">
                <div class="qrcode" style="background-image: url({{ qr_code_uri[label_index] }})"></div>
                <div class="labelText">
                    <div>
                        {%- if show_id or add_label_nr -%}
                            {%- if show_id -%}
                                #{{object_id}}
                            {%- endif -%}
                            {%- if add_label_nr -%}
                                <!-- For the right amount of leading zeros -->
                                {{ ("%0" ~ quantity_digits ~ "d") | format(label_index + 1) }}
                                {%- if add_maximum_label_nr -%}
                                    _{{num_labels}}
                                {%- endif -%}
                            {%- endif -%}
                        {%- else -%}
                            {{object_name}}
                        {%- endif -%}
                    </div>
                    {%- if show_id or add_label_nr -%}
                        <div>{{object_name}}</div>
                    {%- endif -%}
                </div>
            </div>
        {%- endfor -%}
    </body>
</html>