feat: MCP Server para control de impresoras
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 2m8s
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 2m8s
- Endpoint HTTP JSON-RPC en /api/mcp - 6 tools: list_templates, list_printers, print_template, print_raw, create_template, update_template - Guia de formato para impresora TM-U220 - Protegido por Authentik forward auth
This commit is contained in:
206
.claude/epson-tmu220-printing-guide.md
Normal file
206
.claude/epson-tmu220-printing-guide.md
Normal file
@@ -0,0 +1,206 @@
|
||||
# Guia de Impresion para Epson TM-U220
|
||||
|
||||
Esta guia documenta las mejores practicas para generar impresiones legibles en impresoras Epson TM-U220 usando el sistema printerCentral.
|
||||
|
||||
## Especificaciones de la Impresora
|
||||
|
||||
| Caracteristica | Valor |
|
||||
|----------------|-------|
|
||||
| Columnas (Font A) | 40-42 caracteres |
|
||||
| Columnas (Font B) | 33-35 caracteres |
|
||||
| Columnas con doble ancho | ~20 caracteres |
|
||||
| Caracteres por pulgada | 17.8/16 cpi |
|
||||
| Ancho de papel | 57.5mm, 69.5mm, o 76mm |
|
||||
|
||||
## Reglas Fundamentales
|
||||
|
||||
### 1. Limite de Caracteres por Linea
|
||||
|
||||
```
|
||||
Texto normal: max 40 caracteres
|
||||
Texto doble ancho: max 20 caracteres
|
||||
Texto doble alto: max 40 caracteres
|
||||
Texto doble ambos: max 20 caracteres
|
||||
```
|
||||
|
||||
### 2. Caracteres Soportados
|
||||
|
||||
**USAR** - Caracteres ASCII basicos:
|
||||
```
|
||||
= - _ * + | / \ ( ) [ ] < >
|
||||
A-Z a-z 0-9
|
||||
```
|
||||
|
||||
**EVITAR** - Caracteres Unicode extendidos:
|
||||
```
|
||||
Box drawing: ╔ ═ ╗ ║ ╚ ╝ ┌ ┐ └ ┘
|
||||
Simbolos especiales: → ← ↑ ↓ ★ ● ○
|
||||
Emojis: cualquiera
|
||||
```
|
||||
|
||||
### 3. Espaciado con Feed
|
||||
|
||||
Siempre usar `feed` para crear espacio visual. La impresora NO interpreta lineas vacias automaticamente.
|
||||
|
||||
```json
|
||||
{ "op": "feed", "lines": 1 } // Espacio simple
|
||||
{ "op": "feed", "lines": 2 } // Espacio entre secciones
|
||||
{ "op": "feed", "lines": 4 } // Espacio antes del corte
|
||||
```
|
||||
|
||||
## Estructura Recomendada de un Ticket
|
||||
|
||||
### Header (Centrado, Destacado)
|
||||
|
||||
```json
|
||||
{ "op": "align", "align": "center" },
|
||||
{ "op": "style", "bold": true, "width": 2, "height": 2 },
|
||||
{ "op": "text", "value": "TITULO" },
|
||||
{ "op": "style", "bold": false, "width": 1, "height": 1 },
|
||||
{ "op": "feed", "lines": 2 }
|
||||
```
|
||||
|
||||
### Separadores
|
||||
|
||||
Siempre con feed antes y despues para que queden en su propia linea:
|
||||
|
||||
```json
|
||||
{ "op": "text", "value": "================================" },
|
||||
{ "op": "feed", "lines": 1 }
|
||||
```
|
||||
|
||||
Para 40 columnas usar 32 caracteres `=` (deja margen visual).
|
||||
|
||||
### Titulos de Seccion
|
||||
|
||||
Usar bold + underline, seguido de feed:
|
||||
|
||||
```json
|
||||
{ "op": "style", "bold": true, "underline": true },
|
||||
{ "op": "text", "value": "NOMBRE SECCION" },
|
||||
{ "op": "style", "bold": false, "underline": false },
|
||||
{ "op": "feed", "lines": 1 }
|
||||
```
|
||||
|
||||
### Items de Lista
|
||||
|
||||
Cada item con su propio feed para legibilidad:
|
||||
|
||||
```json
|
||||
{ "op": "text", "value": "[ ] Item uno" },
|
||||
{ "op": "feed", "lines": 1 },
|
||||
{ "op": "text", "value": "[ ] Item dos" },
|
||||
{ "op": "feed", "lines": 1 }
|
||||
```
|
||||
|
||||
### Footer y Corte
|
||||
|
||||
```json
|
||||
{ "op": "align", "align": "center" },
|
||||
{ "op": "text", "value": "Texto de pie" },
|
||||
{ "op": "feed", "lines": 4 },
|
||||
{ "op": "cut" }
|
||||
```
|
||||
|
||||
## Ejemplo Completo: Lista de Compras
|
||||
|
||||
```json
|
||||
{
|
||||
"operations": [
|
||||
{ "op": "align", "align": "center" },
|
||||
{ "op": "style", "bold": true, "width": 2, "height": 2 },
|
||||
{ "op": "text", "value": "MI TITULO" },
|
||||
{ "op": "style", "bold": false, "width": 1, "height": 1 },
|
||||
{ "op": "feed", "lines": 2 },
|
||||
|
||||
{ "op": "text", "value": "================================" },
|
||||
{ "op": "feed", "lines": 1 },
|
||||
{ "op": "style", "bold": true },
|
||||
{ "op": "text", "value": "SUBTITULO" },
|
||||
{ "op": "feed", "lines": 1 },
|
||||
{ "op": "style", "bold": false },
|
||||
{ "op": "text", "value": "================================" },
|
||||
{ "op": "feed", "lines": 2 },
|
||||
|
||||
{ "op": "align", "align": "left" },
|
||||
{ "op": "style", "bold": true, "underline": true },
|
||||
{ "op": "text", "value": "SECCION 1" },
|
||||
{ "op": "style", "bold": false, "underline": false },
|
||||
{ "op": "feed", "lines": 1 },
|
||||
{ "op": "text", "value": "[ ] Item A" },
|
||||
{ "op": "feed", "lines": 1 },
|
||||
{ "op": "text", "value": "[ ] Item B" },
|
||||
{ "op": "feed", "lines": 2 },
|
||||
|
||||
{ "op": "align", "align": "center" },
|
||||
{ "op": "text", "value": "================================" },
|
||||
{ "op": "feed", "lines": 1 },
|
||||
{ "op": "text", "value": "Pie de pagina" },
|
||||
{ "op": "feed", "lines": 4 },
|
||||
{ "op": "cut" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Operaciones Disponibles
|
||||
|
||||
| Operacion | Parametros | Ejemplo |
|
||||
|-----------|------------|---------|
|
||||
| `text` | `value` | `{ "op": "text", "value": "Hola" }` |
|
||||
| `feed` | `lines` | `{ "op": "feed", "lines": 2 }` |
|
||||
| `cut` | - | `{ "op": "cut" }` |
|
||||
| `align` | `align`: left, center, right | `{ "op": "align", "align": "center" }` |
|
||||
| `style` | `bold`, `underline`, `width`, `height` | `{ "op": "style", "bold": true }` |
|
||||
|
||||
## Endpoints de Impresion
|
||||
|
||||
### Imprimir Template Guardado
|
||||
|
||||
```
|
||||
POST /api/print/template
|
||||
{
|
||||
"templateId": "template_xxx",
|
||||
"variables": { "nombre": "Juan" },
|
||||
"printerId": "printer_xxx", // opcional
|
||||
"dryRun": false // true para preview
|
||||
}
|
||||
```
|
||||
|
||||
### Imprimir Operaciones Directas
|
||||
|
||||
```
|
||||
POST /api/print/raw
|
||||
{
|
||||
"operations": [...],
|
||||
"variables": { "var1": "valor1" },
|
||||
"printerId": "printer_xxx", // opcional
|
||||
"dryRun": false
|
||||
}
|
||||
```
|
||||
|
||||
## Variables en Templates
|
||||
|
||||
Sintaxis: `{{nombre}}` o `{{nombre:label:default}}`
|
||||
|
||||
```json
|
||||
{ "op": "text", "value": "Cliente: {{cliente}}" },
|
||||
{ "op": "text", "value": "Fecha: {{fecha:Fecha:2025-01-01}}" }
|
||||
```
|
||||
|
||||
## Errores Comunes
|
||||
|
||||
1. **Texto cortado o ilegible**: Excediste 40 caracteres por linea
|
||||
2. **Todo pegado**: Falta usar `feed` entre elementos
|
||||
3. **Caracteres raros**: Usaste Unicode no soportado
|
||||
4. **Separadores mezclados**: Falta `feed` antes/despues de lineas `===`
|
||||
5. **Header muy largo**: Con doble ancho solo caben ~20 chars
|
||||
|
||||
## Checklist Pre-Impresion
|
||||
|
||||
- [ ] Ninguna linea excede 40 caracteres (20 si doble ancho)
|
||||
- [ ] Solo caracteres ASCII basicos
|
||||
- [ ] `feed` entre cada item para legibilidad
|
||||
- [ ] `feed` antes y despues de separadores `===`
|
||||
- [ ] `feed: 4` antes del `cut` final
|
||||
- [ ] Header centrado con estilo destacado
|
||||
- [ ] Secciones con titulos bold+underline
|
||||
Reference in New Issue
Block a user