InvenTree: modelo de local de estoque compatível com Brother QL 62x27mm

Veja também a versão grande (140x62mm) desta etiqueta

Este modelo de etiqueta de local de estoque do InvenTree é totalmente compatível com impressoras de etiquetas Brother QL de 62mm. Eu uso o BrotherQLLabelPrintService para imprimi-las no Linux.

InvenTree 62x27mm stock location

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; /* Margem de segurança uniforme de 2mm em todos os lados */
}

body {
    margin: 0;
    padding: 0;
}

/* Layout de tabela garante posicionamento exato e corrige bugs de múltiplas páginas do WeasyPrint */
.label-table {
    display: table;
    width: calc({{ width }}mm - 4mm);  /* Largura total menos 2mm de margem esquerda e 2mm direita */
    height: calc({{ height }}mm - 4mm); /* Altura total menos 2mm de margem superior e 2mm inferior */
    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); /* Mantém a célula do QR como um quadrado perfeito */
    height: calc({{ height }}mm - 4mm);
    vertical-align: middle;            /* Centraliza o QR code verticalmente */
}

.qr {
    width: calc({{ height }}mm - 4mm);
    height: calc({{ height }}mm - 4mm);
    display: block;
}

.text-cell {
    display: table-cell;
    width: calc({{ width }}mm - {{ height }}mm); /* Preenche dinamicamente o espaço restante */
    height: calc({{ height }}mm - 4mm);
    vertical-align: middle;                      /* CENTRALIZAÇÃO VERTICAL PERFEITA */
    padding-left: 3mm;                           /* Espaço nítido entre QR e texto */
    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;
    
    /* Processamento de layout nativo respeita seus hífens suaves UTF-8 */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* PASSOS DE AJUSTE AUTOMÁTICO DE FONTE (Reduzidos a partir do 21pt original) */
.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