InvenTree Brother-QL compatible 62x27mm stock location template
Also see the large version (140x62mm) 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_62x27.html
{% extends "label/label_base.html" %}
{% load l10n i18n barcode %}
{% block style %}
{% localize off %}
@page {
size: {{ width }}mm {{ height }}mm;
margin: 2mm; /* Uniform 2mm safety margin on all sides */
}
body {
margin: 0;
padding: 0;
}
/* Table layout ensures exact positioning and fixes WeasyPrint multi-page bugs */
.label-table {
display: table;
width: calc({{ width }}mm - 4mm); /* Full width minus 2mm left and 2mm right margins */
height: calc({{ height }}mm - 4mm); /* Full height minus 2mm top and 2mm bottom margins */
table-layout: fixed;
page-break-inside: avoid;
break-inside: avoid;
}
.label-row {
display: table-row;
}
.qr-cell {
display: table-cell;
width: calc({{ height }}mm - 4mm); /* Keeps the QR cell a perfect square */
height: calc({{ height }}mm - 4mm);
vertical-align: middle; /* Vertically centers the QR code */
}
.qr {
width: calc({{ height }}mm - 4mm);
height: calc({{ height }}mm - 4mm);
display: block;
}
.text-cell {
display: table-cell;
width: calc({{ width }}mm - {{ height }}mm); /* Dynamically fills remaining space */
height: calc({{ height }}mm - 4mm);
vertical-align: middle; /* PERFECT VERTICAL CENTERING */
padding-left: 3mm; /* Crisp gap between QR and text */
box-sizing: border-box;
overflow: hidden;
}
{% endlocalize %}
.loc {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
line-height: 1.05;
margin: 0;
padding: 0;
/* Native layout processing honors your UTF-8 soft hyphens */
white-space: normal;
word-wrap: break-word;
overflow-wrap: break-word;
}
/* AUTOMATIC FONT ADJUSTMENT STEPS (Scaled down from original 21pt) */
.loc.large { font-size: 21pt; }
.loc.medium { font-size: 15pt; }
.loc.small { font-size: 11pt; }
{% 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 > 20 %}small{% elif location.name|length > 10 %}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