feat: adicionar suporte a impressoras pequenas com parâmetro dpi e layout adaptativo para etiquetas

This commit is contained in:
2026-03-14 21:21:15 -03:00
parent b6e4aa7622
commit 5c8d6a368e
6 changed files with 261 additions and 64 deletions
@@ -49,6 +49,9 @@ pub struct LabelQuery {
/// Campos a incluir, separados por vírgula: color,name,material_brand,net_weight,print_temp,qrcode
/// Se ausente, inclui todos.
pub fields: Option<String>,
/// DPI alvo da impressora. Padrão: 96 (tela). Use 203 para Niimbot/térmicas de baixo custo,
/// 300 para Brother/Dymo premium. Afeta resolução do QR Code no SVG e dimensionamento físico.
pub dpi: Option<u32>,
}
fn default_width_mm() -> u32 { 50 }
@@ -297,7 +300,7 @@ pub async fn export_label_pdf_handler(
) -> Result<impl IntoResponse, AppError> {
let pdf = state
.filament_service
.generate_label_pdf(id, user.id, query.width_mm, query.height_mm, query.fields.as_deref())
.generate_label_pdf(id, user.id, query.width_mm, query.height_mm, query.fields.as_deref(), query.dpi)
.await?;
let filename = format!("meowspool-label-{id}.pdf");
@@ -321,7 +324,7 @@ pub async fn export_label_handler(
) -> Result<impl IntoResponse, AppError> {
let svg = state
.filament_service
.generate_label_svg(id, user.id, query.width_mm, query.height_mm, query.fields.as_deref())
.generate_label_svg(id, user.id, query.width_mm, query.height_mm, query.fields.as_deref(), query.dpi)
.await?;
let filename = format!("meowspool-label-{id}.svg");