From 25475b5571845495508d6f1e403f161020f30044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 25 Sep 2022 02:57:32 +0200 Subject: [PATCH] Labels now do not break page if the content gets too long. This fixes issue #65. --- .../LabelSystem/labels/base_label.html.twig | 2 +- .../LabelSystem/labels/label_style.css.twig | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/templates/LabelSystem/labels/base_label.html.twig b/templates/LabelSystem/labels/base_label.html.twig index 4c41a048..d3c1b999 100644 --- a/templates/LabelSystem/labels/base_label.html.twig +++ b/templates/LabelSystem/labels/base_label.html.twig @@ -13,7 +13,7 @@ {% for element in elements %} -
+
{% if options.barcodeType == 'none' %} {% include "LabelSystem/labels/label_page_none.html.twig" %} {% elseif options.barcodeType in ['qr', 'datamatrix'] %} diff --git a/templates/LabelSystem/labels/label_style.css.twig b/templates/LabelSystem/labels/label_style.css.twig index ff407982..c2434a77 100644 --- a/templates/LabelSystem/labels/label_style.css.twig +++ b/templates/LabelSystem/labels/label_style.css.twig @@ -2,6 +2,25 @@ margin: 12px 6px; } +.page { + page-break-inside: avoid; + page-break-before: avoid; + page-break-after: always; + + overflow: hidden; + /* Absolute position prevents automatic page breaks */ + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +/* Last page should not break */ +.page:last-of-type { + page-break-after: avoid; +} + body { font-family: "DejaVu Sans Mono"; font-size: 12px;