shinyorg/shiny/shiny-printing
Claude Code and agent skill by shinyorg/shiny
- community
Checking that the SKILL.md file is still in the repository.
Generate code using Shiny.Printers and Shiny.Printing for .NET - thermal / receipt printing (ESC/POS, TSPL) with a fluent PrintDocument over Bluetooth LE, WiFi (raw TCP 9100 + mDNS discovery or subnet sweep, ESC/POS status read-back) and browser Web Bluetooth / Web Serial / WebUSB, plus OS-native printing of PDF, image, HTML and files through AirPrint, Android PrintManager, Windows GDI+/shell, CUPS and window.print, and rendering a receipt to PDF with SkiaSharp
Install
npx vskill@latest install shinyorg/shiny/shiny-printingSKILL.md
The same SKILL.md was published earlier as shinyorg/shiny/shiny-printing.
Shiny Printing
Two separate printing models. Pick by the printer, not by the platform:
| You have | Use | What it does | |
|---|---|---|---|
| A 58/80mm receipt, label or kitchen printer | `Shiny.Printers` + a transport package | You build a PrintDocument; an encoder turns it into ESC/POS (or TSPL) bytes; a transport streams them. The app owns layout. | |
| Any printer the OS knows about (AirPrint, laser, inkjet, CUPS queue) | `Shiny.Printing` | You hand a PDF / image / HTML / file to the OS print pipeline (dialog, spooler, driver). |
They meet in one place: Shiny.Printing.Rendering renders a thermal PrintDocument to a PDF, so the same receipt can go to either.
Packages
| Package | Platforms | Purpose | |
|---|---|---|---|
Shiny.Printers | any .NET | Document model, PrinterCapabilities, EscPosProtocol, TsplProtocol, PrinterImage, plus the Blazor (WASM / Server) Web Bluetooth, Web Serial and WebUSB transports (AddBrowserPrinting(), namespace Shiny.Printers.Blazor). AOT/trim clean. | |
Shiny.Printers.BluetoothLE | iOS, Mac Catalyst, macOS, Android, Windows, Linux | Scan + connect BLE printers via Shiny.BluetoothLE, MTU-chunked writes. | |
Shiny.Printers.Network | everywhere incl. Blazor Server | Raw TCP (port 9100) + mDNS discovery via Shiny.Net.Discovery. | |
Shiny.Printing | iOS, Mac Catalyst, Android, Windows, Linux, macOS, Blazor | IPrintService - AirPrint / PrintManager / GDI+ + shell / CUPS, and window.print() on Blazor (AddNativePrinting() picks it on WebAssembly; AddBlazorPrinting() for Blazor Server). | |
Shiny.Printing.Rendering | any .NET | IPrintDocumentRenderer - PrintDocument -> PDF with SkiaSharp. |
Registration
Every Add* extension lives in namespace Shiny.
Calling AddBluetoothLE<TDelegate>() yourself as well as AddBluetoothLePrinting() is fine - BLE registration is idempotent.
Thermal printing
Build a document
Rules:
- Lay out against `printer.Capabilities`, never hard-coded widths.
CharactersPerLineis the column count at 1x
(32 on 58mm, 48 on 80mm); DotsPerLine is the max image width (384 / 576).
Size(w, h)takes 1-8.ResetStyle()resets alignment, bold, underline and size.WrapText(text, caps.CharactersPerLine)word-wraps long text.Raw(bytes)is the escape hatch for
printer-specific commands (cash drawer kick, code pages).
- Non-ASCII text: set
EscPosProtocol.Encodingand the matchingCodePage- the default is ASCII / PC437.
Images
The core never decodes PNG/JPEG. Decode to RGBA yourself (SkiaSharp on MAUI, canvas in the browser) and convert:
ImageDithering.Threshold for logos / line art, FloydSteinberg for photos. RGBA byte order is R, G, B, A; transparency is composited onto white. With SkiaSharp decode as SKColorType.Rgba8888 / SKAlphaType.Unpremul.
Bluetooth LE
DiscoveredPrinter=Peripheral,Name,Rssi, matchedConfig. The same printer is emitted repeatedly -
de-duplicate on Uuid.
- Unknown printer? Add a profile to
KnownPrinterProfiles.Allat startup, or connect with an explicit config:
Garbled or truncated output on a cheap printer: lower ChunkSize and raise InterChunkDelay.
WiFi / Ethernet
DiscoveredNetworkPrinter.Capabilitiesdefaults to 80mm - mDNS never advertises paper width. Use
found with { Capabilities = PrinterCapabilities.Paper58mm } when you know better.
Scan(serviceType)browses a vendor-specific DNS-SD type.- Same
PrintDocument, same disposal:(printer as IDisposable)?.Dispose()closes the socket.
Printer not found by Scan()? Most cheap receipt printers never advertise mDNS - sweep the subnet for port 9100:
- Default
Networks = nullsweeps each active IPv4 interface's subnet, narrowed to its /24, skipping the device itself. - Swept results:
Name= IP,ServiceType="",Method = NetworkPrinterDiscoveryMethod.PortSweep. Merging with
Scan()? de-duplicate on $"{Host}:{Port}".
- Anything on 9100 answers (laser printers too). A printer busy with another client's connection may be missed.
Printer status (paper out, cover open, cutter, drawer)
PrinterStatus:IsOnline,IsCoverOpen,IsPaperOut,IsPaperNearEnd,IsCutterError,
HasUnrecoverableError, HasAutoRecoverableError, IsDrawerSensorHigh (polarity depends on the drawer - never call it "open" without checking), plus CanPrint / HasError.
- Never call
GetStatus()without checkingSupportsStatus- it throwsNotSupportedException. - Timeout:
NetworkPrinterConfig.StatusTimeout(default 3s). Non-status reply ->InvalidDataException. - Safe to call while printing - the query waits for the in-flight send.
Blazor (browser transports)
- No scanner on the web.
RequestBluetooth()/RequestSerial()/RequestUsb()open the browser chooser and
connect in one call. Never call them from OnInitialized / OnAfterRender.
- Chromium only (Chrome, Edge, Opera), secure context only (HTTPS or localhost), never iOS. Feature-detect with
GetSupport().
- Web Bluetooth cannot read the MTU, so
WebBluetoothPrinterConfig.ChunkSizedefaults to 180. - WebUSB fights the OS printer driver - prefer Web Serial where the device has a port.
- Port-9100 printers are unreachable from WASM (no raw sockets). Under Blazor Server use
Shiny.Printers.Network - the socket runs server-side.
Custom transport or protocol
Implement IPrinterConnection (IsConnected, WhenStatusChanged() replaying the current state, SendAsync(ReadOnlyMemory<byte>) honouring the transport's payload limit) or IPrinterProtocol (Encode(PrintDocument, PrinterCapabilities) => byte[]), then compose: new Printer(connection, protocol, caps). For status, the transport also implements IPrinterQueryConnection (Query(request, responseLength)) and the protocol IPrinterStatusProtocol (QueryStatus(connection)); Printer.SupportsStatus lights up when both do.
OS-native printing
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/shiny-printing/SKILL.md
Popularity
- Repository stars
- 1,583
- Repository forks
- 248
- 7-day trend score
- 42
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/shinyorg/shiny/shiny-printing)