Etiquetas#
O Sulfite suporta um modo etiqueta para gerar folhas ou rolos de etiquetas. Configura-se via labelConfig
dentro de pageSettings.
Configuração#
{
"pageSettings": {
"format": "A4",
"orientation": "portrait",
"margins": { "left": 5, "right": 5, "top": 5, "bottom": 5 },
"labelConfig": {
"format": "sheet",
"columns": 3,
"rows": 13,
"labelWidthMm": 33,
"labelHeightMm": 21,
"columnGapMm": 2,
"rowGapMm": 0,
"sheetMarginTopMm": 5,
"sheetMarginBottomMm": 5,
"sheetMarginLeftMm": 5,
"sheetMarginRightMm": 5
}
}
}
Propriedades do LabelConfig#
| Propriedade | Tipo | Padrão | Descrição |
|---|---|---|---|
format |
string |
"sheet" |
"sheet" (folha) ou "roll" (rolo contínuo) |
columns |
int |
1 |
Número de colunas de etiquetas |
rows |
int |
0 |
Linhas por página (0 = contínuo) |
labelWidthMm |
double |
100.0 |
Largura de cada etiqueta em mm |
labelHeightMm |
double |
50.0 |
Altura de cada etiqueta em mm |
columnGapMm |
double |
0.0 |
Espaço horizontal entre colunas |
rowGapMm |
double |
0.0 |
Espaço vertical entre linhas |
sheetMarginTopMm |
double |
5.0 |
Margem superior da folha |
sheetMarginBottomMm |
double |
5.0 |
Margem inferior |
sheetMarginLeftMm |
double |
5.0 |
Margem esquerda |
sheetMarginRightMm |
double |
5.0 |
Margem direita |
presetName |
string? |
null |
Nome de um preset pré-configurado |
Presets#
O Sulfite inclui presets de etiquetas comuns:
| Preset | Formato | Tamanho (mm) | Colunas × Linhas |
|---|---|---|---|
| Rolo 100×50mm | roll | 100 × 50 | 1 × contínuo |
| Rolo 50×30mm | roll | 50 × 30 | 1 × contínuo |
| Rolo 80×40mm | roll | 80 × 40 | 1 × contínuo |
| Couché 50×30mm | sheet | 50 × 30 | 2 × contínuo |
| A4 33×21mm | sheet | 33 × 21 | 3 × 13 |
| A4 50×30mm | sheet | 50 × 30 | 2 × 9 |
| A4 70×33mm | sheet | 70 × 33 | 2 × 8 |
| A4 100×42mm | sheet | 100 × 42 | 1 × 6 |
| A4 105×74mm | sheet | 105 × 74 | 2 × 4 |
Para usar um preset:
{
"labelConfig": {
"presetName": "A4 50×30mm"
}
}
Como funciona#
Quando labelConfig está presente, o PDF renderer distribui os registros da DetailBand
em grade:
┌─────────┬─────────┬─────────┐
│ Label 1 │ Label 2 │ Label 3 │
├─────────┼─────────┼─────────┤
│ Label 4 │ Label 5 │ Label 6 │
├─────────┼─────────┼─────────┤
│ Label 7 │ Label 8 │ Label 9 │
├─────────┼─────────┼─────────┤
│ ... │ ... │ ... │
└─────────┴─────────┴─────────┘
Cada etiqueta contém os mesmos elementos da DetailBand, posicionados internamente por x
e y.
Exemplo: etiqueta com barcode#
{
"bands": [
{
"type": "detail",
"id": "label",
"dataSourceId": "products",
"height": 50,
"elements": [
{ "type": "field", "id": "name", "x": 2, "y": 2, "width": 96, "binding": "product_name", "fontSize": 8 },
{ "type": "barcode", "id": "code", "x": 10, "y": 15, "width": 80, "height": 30, "value": "SKU-001", "format": "CODE128", "drawText": true }
]
}
]
}
Limitações#
- Modo etiqueta é suportado apenas no PDF renderer
- HTML, CSV e Excel ignoram o
labelConfig