Superroute.SPrint 0.1.6

dotnet add package Superroute.SPrint --version 0.1.6
                    
NuGet\Install-Package Superroute.SPrint -Version 0.1.6
                    
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="Superroute.SPrint" Version="0.1.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Superroute.SPrint" Version="0.1.6" />
                    
Directory.Packages.props
<PackageReference Include="Superroute.SPrint" />
                    
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 Superroute.SPrint --version 0.1.6
                    
#r "nuget: Superroute.SPrint, 0.1.6"
                    
#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 Superroute.SPrint@0.1.6
                    
#: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=Superroute.SPrint&version=0.1.6
                    
Install as a Cake Addin
#tool nuget:?package=Superroute.SPrint&version=0.1.6
                    
Install as a Cake Tool

Superroute.SPrint

sPrint for .NET: Superroute's printing SDK. Find network, USB and Bluetooth printers, detect their command language (ZPL, TSPL, ESC/POS, CPCL and the vendor dialects), print labels, PDF, HTML, images and raw bytes, and turn the machine into a Superroute print node.

using Superroute.SPrint;

using var printers = new PrinterRegistry("printers.json");
printers.Save(new TargetPrinter { Name = "Labels", Host = "192.168.1.40", Transport = Transports.Network, Language = Languages.Zpl });

var label = LabelJob.Parse(File.ReadAllText("label.json"));
var result = printers.Print(new PrintJob { Type = JobTypes.Label, Label = label });
if (!result.Ok) Console.WriteLine($"{result.Reason}: {result.Message}");

foreach (var p in Discovery.ScanNetwork()) Console.WriteLine($"{p.Name} {p.Host}");

using var node = new PrintNode(printers, savedState);
node.StateChanged += (_, s) => Save(s);  // holds the node token
node.Pair("K2M9XY");                      // the code from the Print Nodes page
node.Start();

The host app may answer remote commands first, follow the server's printer settings and jobs in flight, and add its own heartbeat fields (see docs/NODE-HOOKS.md):

using var node = new PrintNode(printers, savedState,
    onCommand: async c => c.Action == "connectivity_test"
        ? new CommandAnswer { Output = await CheckNetwork() }
        : null,                                     // null: the node answers it
    commandsEvery: TimeSpan.FromSeconds(15));
node.SettingsChanged += (_, s) => ShowLocks(s.Locks, s.Paper);   // languages, locks, default papers: already applied
node.Printing += (_, e) => ShowPrinting(e.Printer, e.Started);  // cloud and peer jobs
node.SetPrinterFields("Labels", new JsonObject { ["language_kept"] = kept });
var refused = node.PushLanguages(new Dictionary<string, string> { ["Labels"] = "zpl" });
var media = SPrint.QueryZplMedia(zebra);                        // dpi, width × length mm; null: no answer

A language the client locked is refused by PrinterRegistry.Save and by PushLanguages, except a post-job correction passed in corrections.

LAN peer printing

Two devices on the same network print to each other's shared printers with no server in between (the SuperPrinter apps' peer-direct protocol). A host shares nothing until it names its printers, and admits peers in approval mode unless told otherwise; sPrint keeps no files for peers, so store the state it hands over.

// The printer owner
using var host = new PeerHost(printers, state: savedPeerState, name: "Front desk");
host.StateChanged += (_, s) => Save(s);                       // identity, mode, shared printers, trust list
host.ApprovalRequested += (_, p) => host.Decide(p.Id, AskOwner(p.Name, p.Fingerprint, p.Note));
host.SetShared(new[] { "Labels" });
host.SetDiscoverable(true);                                   // advertised over mDNS
host.Start();

// The printer user
using var me = PeerIdentity.FromSeed(savedSeed);
var peer = Discovery.BrowsePeers().First();
using var session = PeerSession.Connect(me, new PeerConnectOptions { Addr = peer.Addr, Fingerprint = peer.Fingerprint, Note = "Packing desk" });
if (session.Status.Status == "pending") session.WaitApproval();  // SPrintException Code "denied" / "timeout"
session.Ended += (_, e) => Console.WriteLine($"ended: {e.Reason}");
var result = session.Print("Labels", new PrintJob { Type = JobTypes.Label, Label = label });
printers.AttachPeer(session);                                 // or route jobs to "peer:<fingerprint>/Labels"

Native libraries are included for Windows (x64, arm64), macOS (arm64, x64) and Linux (x64, arm64, arm). On Windows the package also copies SumatraPDF.exe (PDF to a printer driver) and blepair.exe (bonding BLE printers) next to your executable; set <SPrintWindowsHelpers>false</SPrintWindowsHelpers> to leave them out.

Licensed under the Superroute SDK License.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.6 52 10/31/2026
0.1.5 47 10/30/2026
0.1.2 53 10/30/2026
0.1.1 50 10/30/2026
0.1.0 47 10/30/2026