2024-05-20 21:14:32 +02:00
{% import "vars.macro.twig" as vars %}
2020-04-14 11:07:07 +02:00
<!DOCTYPE html>
<html>
2020-04-24 22:10:49 +02:00
<head>
<meta charset="UTF-8">
<title> {{ meta_title }} </title>
2024-05-20 21:14:32 +02:00
<meta name="author" content=" {{ vars .partdb_title ( ) }} ">
2020-04-24 22:10:49 +02:00
<meta name="description" content="Label for {{ meta_title }} ">
<meta name="keywords" content="Part-DB, Label, Barcode">
<style>
2023-02-04 23:15:11 +01:00
{% include ( "label_system/labels/label_style.css.twig" ) %}
2023-07-02 03:28:17 +02:00
{# We must not escape it here, as the string might contain ", which would be escaped. As user can control the whole HTML, XSS is not really a problem here. #}
{{ options .additionalCss | raw }}
2020-04-24 22:10:49 +02:00
</style>
</head>
<body>
2025-08-14 15:00:23 +02:00
{% set start_page %}
2025-10-17 00:20:40 +02:00
{# The page div ensures the page breaks, while the page-inner elements restrict the content to the page size. Sine dompdf 3.1.1 we cannot apply the position: absolute; to the page element directly. #}
2022-09-25 02:57:32 +02:00
<div class="page">
2025-11-07 13:46:40 +01:00
<div class="page-inner">
<table col=" {{ options .xcount }} " row=" {{ options .ycount }} "><tr>
2025-08-14 15:00:23 +02:00
{% endset %}
{% set end_page %}
</tr></table></div>
{% endset %}
{{ start_page }}
{% set labels = ( 0 .. options .skipcount ) | merge ( elements ) %}
{% for element in labels %}
{% if loop .first %}
{# continue #}
{% else %}
<td>
{% if element <= options .skipcount %}
{% elseif options .barcodeType .none %}
{% include "label_system/labels/label_page_none.html.twig" %}
{% elseif options .barcodeType .is2D ( ) %}
{% include "label_system/labels/label_page_qr.html.twig" %}
{% elseif options .barcodeType .is1D ( ) %}
{% include "label_system/labels/label_page_1d.html.twig" %}
{% endif %}
</td>
{% if not loop .last %}
{# The current row is full. Start a new row #}
{% if ( loop .index > 2 ) and loop .index0 is divisible by ( options .xcount ) %}
</tr><tr>
{% endif %}
{# The current page is full and there are still labels in the queue. Start a new page #}
{% if loop .index0 is divisible by ( options .xcount * options .ycount ) %}
{{ end_page }}
{{ start_page }}
{% endif %}
{% else %}
{# last iteration: fill the row if the generated label count is too small #}
{% for i in ( labels | length - 1 ) .. options .xcount %}
{% if labels | length - 1 < options .xcount and i < options .xcount %}
<td></td>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{{ end_page }}
2020-04-24 22:10:49 +02:00
</body>
2025-10-17 00:20:40 +02:00
</html>