Labels now do not break page if the content gets too long.

This fixes issue #65.
This commit is contained in:
Jan Böhmer 2022-09-25 02:57:32 +02:00
parent 86c580f835
commit 25475b5571
2 changed files with 20 additions and 1 deletions

View file

@ -13,7 +13,7 @@
</head> </head>
<body> <body>
{% for element in elements %} {% for element in elements %}
<div style="page-break-inside: avoid; page-break-before: avoid; {% if not loop.last %}page-break-after: always;{% endif %}"> <div class="page">
{% if options.barcodeType == 'none' %} {% if options.barcodeType == 'none' %}
{% include "LabelSystem/labels/label_page_none.html.twig" %} {% include "LabelSystem/labels/label_page_none.html.twig" %}
{% elseif options.barcodeType in ['qr', 'datamatrix'] %} {% elseif options.barcodeType in ['qr', 'datamatrix'] %}

View file

@ -2,6 +2,25 @@
margin: 12px 6px; 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 { body {
font-family: "DejaVu Sans Mono"; font-family: "DejaVu Sans Mono";
font-size: 12px; font-size: 12px;