InvenTree Brother-QL compatible 140x62mm stock location template
Also see the small version (62x27mm) of this label
This InvenTree stock location label template is fully compatible with Brother 62mm QL-series label printers. I use BrotherQLLabelPrintService to print them on Linux.

stock_location_140x62.html
{% extends "label/label_base.html" %}
{% load l10n i18n barcode %}
{% block style %}
@page {
size: 140mm 62mm;
margin: 2mm; /* Guarantees strict 2mm space on top, bottom, left, and right */
}
body {
margin: 0;
padding: 0;
}
/* Table layout is immune to WeasyPrint's multi-page splitting bug */
.label-table {
display: table;
width: 136mm; /* 140mm - 4mm total margins */
height: 58mm; /* 62mm - 4mm total margins */
table-layout: fixed;
page-break-inside: avoid;
break-inside: avoid;
}
.label-row {
display: table-row;
}
.qr-cell {
display: table-cell;
width: 58mm;
height: 58mm;
vertical-align: middle; /* Centers QR code vertically */
}
.qr {
width: 58mm;
height: 58mm;
display: block;
}
.text-cell {
display: table-cell;
width: 78mm; /* Remaining label space */
height: 58mm;
vertical-align: middle; /* CRUCIAL: Centers text block perfectly vertically */
padding-left: 5mm; /* Gap between QR and text */
box-sizing: border-box;
overflow: hidden; /* Safety net to prevent multi-page overflows */
}
.loc {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
line-height: 1.05;
margin: 0;
padding: 0;
/* Support your native UTF-8 soft hyphens wrapping */
white-space: normal;
word-wrap: break-word;
overflow-wrap: break-word;
}
/* AUTOMATIC ADJUSTING STEPS */
/* Standard short names (like Bechergläser) */
.loc.large { font-size: 52pt; }
/* Medium length names */
.loc.medium { font-size: 36pt; }
/* Exceptionally long text (like Test mit sehr langem Label) */
.loc.small { font-size: 26pt; }
{% endblock style %}
{% block content %}
<div class="label-table">
<div class="label-row">
<div class="qr-cell">
<img class='qr' alt="{% trans 'QR code' %}" src='{% qrcode qr_data %}'>
</div>
<div class="text-cell">
<div class="loc {% if location.name|length > 22 %}small{% elif location.name|length > 12 %}medium{% else %}large{% endif %}">
{{ location.name }}
</div>
</div>
</div>
</div>
{% endblock content %}Check out similar posts by category:
InvenTree
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow