MotorDsl.Printing.Abstractions 1.0.12

dotnet add package MotorDsl.Printing.Abstractions --version 1.0.12
                    
NuGet\Install-Package MotorDsl.Printing.Abstractions -Version 1.0.12
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MotorDsl.Printing.Abstractions" Version="1.0.12" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MotorDsl.Printing.Abstractions" Version="1.0.12" />
                    
Directory.Packages.props
<PackageReference Include="MotorDsl.Printing.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MotorDsl.Printing.Abstractions --version 1.0.12
                    
#r "nuget: MotorDsl.Printing.Abstractions, 1.0.12"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MotorDsl.Printing.Abstractions@1.0.12
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MotorDsl.Printing.Abstractions&version=1.0.12
                    
Install as a Cake Addin
#tool nuget:?package=MotorDsl.Printing.Abstractions&version=1.0.12
                    
Install as a Cake Tool

🖨️ MotorDsl — Motor de generación de documentos térmicos para .NET MAUI

Sistema de generación y renderizado de documentos basado en un DSL JSON, con foco en impresión térmica ESC/POS por Bluetooth desde aplicaciones .NET MAUI. Construido sobre .NET 10, modular, extensible vía transports y renderers.


⚡ TL;DR

Para implementadores:

dotnet add package MotorDsl.Maui
dotnet add package MotorDsl.Bluetooth

MotorDsl.Maui trae como dependencias transitivas MotorDsl.Printing.Abstractions, MotorDsl.Core, MotorDsl.Rendering y MotorDsl.Extensions. Con esos dos PackageReference queda armado el stack completo para una app MAUI con impresión Bluetooth en Android.


📦 Paquetes NuGet

Paquete TFM Rol Dependencias
MotorDsl.Core net10.0 Núcleo: contratos, modelos, evaluador, layout
MotorDsl.Parser net10.0 Parser DSL JSON → AST Core
MotorDsl.Rendering net10.0 Renderers Text + EscPos básicos Core
MotorDsl.Extensions net10.0 Fluent DI: AddMotorDslEngine, AddTemplates, AddProfiles, AddRenderer Core, Parser, Rendering
MotorDsl.Printing.Abstractions net10.0 Contratos transport-agnostic (IThermalPrinterTransport, IThermalPrinterService, PrinterDevice) y orquestador con retry/eventos Core
MotorDsl.Bluetooth net10.0-android;net10.0-ios Transport BT Classic SPP (Android). iOS lanza PlatformNotSupportedException Printing.Abstractions
MotorDsl.Maui net10.0-android;net10.0-ios Controles MAUI (PrinterStatusBadge, PrinterPickerView, MauiRasterPreview, MauiDocumentPreview, MauiDiagnosticsView), renderers (PDF, ESC/POS bitmap, raster preview), MauiPrintErrorHandler y diagnóstico (MauiDiagnosticsReportProvider) Core, Rendering, Extensions, Printing.Abstractions

🚀 Quickstart .NET MAUI

1. Instalación (en tu app MAUI)

<ItemGroup>
  <PackageReference Include="MotorDsl.Maui"      Version="<latest>" />
  <PackageReference Include="MotorDsl.Bluetooth" Version="<latest>" />
</ItemGroup>

2. Configurar en MauiProgram.cs

using Microsoft.Extensions.Logging;
using MotorDsl.Bluetooth;
using MotorDsl.Core.Models;
using MotorDsl.Extensions;
using MotorDsl.Maui;

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
            });

        // Motor DSL: pipeline + templates + profiles + renderers MAUI
        builder.Services.AddMotorDslEngine()
            .AddTemplates(t =>
            {
                t.Add("acta-infraccion-integrada", MultaIntegratedDsl.Document);
            })
            .AddProfiles(p =>
            {
                p.Add(new DeviceProfile("thermal_58mm", 32, "escpos-bitmap"));
                p.Add(new DeviceProfile("preview", 32, "raster-preview"));
                p.Add(new DeviceProfile("a4-pdf", 80, "pdf"));
            })
            .AddMotorDslMaui();

        // Transport Bluetooth (Android Classic SPP)
        builder.Services.AddBluetoothPrinterTransport();

#if DEBUG
        builder.Logging.AddDebug();
#endif
        return builder.Build();
    }
}

3. Permisos Android (Platforms/Android/AndroidManifest.xml)

<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
                 android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

4. UI declarativa con los componentes incluidos

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:muic="clr-namespace:MotorDsl.Maui.Controls;assembly=MotorDsl.Maui">
    <VerticalStackLayout Padding="16" Spacing="12">
        <muic:PrinterStatusBadge x:Name="StatusBadge" />
        <muic:PrinterPickerView  x:Name="DevicePicker" FilterKind="bluetooth" />
        <muic:MauiRasterPreview  x:Name="RasterPreview" ZoomFactor="2" />
        <Button Text="Imprimir" Clicked="OnImprimir" />
    </VerticalStackLayout>
</ContentPage>

5. Code-behind

using MotorDsl.Core.Contracts;
using MotorDsl.Core.Models;
using MotorDsl.Printing;

public partial class MainPage : ContentPage
{
    private readonly IDocumentEngine _engine;
    private readonly IThermalPrinterService _printer;

    public MainPage(IDocumentEngine engine, IThermalPrinterService printer)
    {
        InitializeComponent();
        _engine  = engine;
        _printer = printer;
        StatusBadge.Service  = _printer;
        DevicePicker.Service = _printer;
    }

    private async void OnImprimir(object? sender, EventArgs e)
    {
        var profile = new DeviceProfile("thermal_58mm", 32, "escpos-bitmap");
        var result  = _engine.Render(json, profile);
        if (result.IsSuccessful && _printer.IsConnected)
            await _printer.SendBytesAsync((byte[])result.Output!);
    }
}

6. Diagnóstico y reporte de fallos

AddMotorDslMaui() también registra un IDiagnosticsReportProvider que captura versiones de librería, info de app, dispositivo, impresora y permisos. El reporte se puede ver en pantalla, imprimir como ticket térmico (con QR de correlación) o compartir por email/WhatsApp/clipboard vía Share API. Ver diagnostics.md para el patrón completo de los 3 botones.


🏗️ Arquitectura (resumen)

[DSL JSON] → Parser → Evaluator → Layout → Renderer → Output
                                              ↓
                                    Transport (Bluetooth / USB / Red)
                                              ↓
                                          Impresora física
  • Pipeline DSL: JSON → AST → modelo evaluado → modelo con layout → bytes finales (texto, ESC/POS, PDF, raster preview).
  • Renderers son IRenderer con un Target string. El profile elige qué renderer usar.
  • Transports son IThermalPrinterTransport con un Kind string. El servicio enruta el PrinterDevice al transport correcto. Extensible a USB / Red / BLE sin tocar el orquestador.

📄 Detalles:


📂 Estructura del repositorio

PrintThermal_Motor_Maui/
├── src/
│   ├── MotorDsl.Core/                    Núcleo del motor (modelos, contratos, evaluador, layout)
│   ├── MotorDsl.Parser/                  Parser DSL JSON
│   ├── MotorDsl.Rendering/               Renderers texto + ESC/POS
│   ├── MotorDsl.Extensions/              Fluent DI (AddMotorDslEngine)
│   ├── MotorDsl.Printing.Abstractions/   Contratos de transport + orquestador
│   ├── MotorDsl.Bluetooth/               Transport BT Classic SPP (Android)
│   ├── MotorDsl.Maui/                    Controles + renderers + error handler MAUI
│   └── MotorDsl.Tests/                   Tests del motor
├── samples/
│   ├── MotorDsl.SampleApp/                       Sample mínimo (sin BT)
│   ├── MotorDsl.MultaApp/                        Sample multa con servicios locales
│   ├── MotorDsl.Integrated.MultaApp/             Sample con DSL integrado (datos en plantilla)
│   ├── MotorDsl.Nuget.MultaApp/                  Sample que valida los paquetes NuGet
│   └── MotorDsl.Nuget.Integrated.MultaApp/       Sample integrado vía NuGet
├── docs/                                  Documentación funcional, técnica, sprints, ejemplos
├── scripts/
│   ├── local/                            Scripts dotnet build local
│   ├── mobile/                           Publicación APK Android
│   └── nuget/                            Publicación a nuget.org
└── nupkg/                                 .nupkg generados (gitignored)

🧪 Samples disponibles

Sample Qué demuestra
MotorDsl.SampleApp Demo mínimo: render a texto y ESC/POS sin transport.
MotorDsl.MultaApp Sample completo de multa de tránsito con servicios locales.
MotorDsl.Integrated.MultaApp Sample con DSL en formato "integrated" (datos pre-resueltos).
MotorDsl.Nuget.MultaApp Equivalente a MultaApp pero consumiendo los paquetes NuGet.
MotorDsl.Nuget.Integrated.MultaApp Equivalente al Integrated pero vía NuGet.

Detalles en samples/Readme.md.


🛠️ Cómo compilar y correr

Prerrequisitos

  • .NET 10 SDK
  • Workload maui instalado: dotnet workload install maui
  • Android SDK (para correr samples en Android)

Build local

dotnet build src/MotorDsl.Maui/MotorDsl.Maui.csproj -c Debug

Correr un sample en Android

dotnet build -t:Run -f net10.0-android samples/MotorDsl.Nuget.Integrated.MultaApp/MotorDsl.Nuget.Integrated.MultaApp.csproj

Más detalles en scripts/local/Readme.md y en scripts/mobile/Readme.md.


📤 Publicación NuGet

Los 7 paquetes se publican unificados con la misma versión vía:

scripts/nuget/publish-motordsl-nuget.bat

Detalles en scripts/nuget/notas.md.


🗺️ Roadmap

  • ✅ Transport Bluetooth Classic SPP (Android)
  • ⏳ Transport USB
  • ⏳ Transport BLE / Red TCP
  • ⏳ Renderer raster con nearest-neighbor real (SKCanvasView)
  • ⏳ EAN-13 nativo en raster preview y PDF (hoy fallback a texto)

📜 Licencia

MIT.


🤝 Contribución y contacto

Fernando Rafael Filipuzzi — Aplicada Streaming 2026

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on MotorDsl.Printing.Abstractions:

Package Downloads
MotorDsl.Maui

Controles MAUI y renderers (PDF, ESC/POS bitmap, SkiaSharp) para MotorDsl.

MotorDsl.Bluetooth

Transport Bluetooth Classic SPP (Android) para MotorDsl. iOS no soportado (lanza PlatformNotSupportedException).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.12 36 6/10/2026
1.0.11 32 6/10/2026
1.0.10 109 5/18/2026
1.0.9 48 5/6/2026
1.0.8 46 5/6/2026
1.0.7 48 5/6/2026
1.0.6 58 5/6/2026
1.0.5 51 5/6/2026

Release 1.0.12