BradyCorp.Maui.SDK 3.2.1

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

BradyCorp.MAUI.SDK

Everyone wants an easier way to print. Especially in the field, where dollars are attached to minutes. If your apps can’t connect to a Brady printer, here’s the fix: Brady’s Software Development Kit (SDK). With it, your employees can use their own mobile app to print labels. It’s fast. It’s convenient. It’s a seamless way to get your label data to a Brady printer.

This Brady Print SDK .NET MAUI package is a display of what the Brady SDK can achieve. You will then have the ability to discover, connect, and print your desired templates and images with the API. The package also allows you to see over a dozen printer details and allows you to customize how labels print.

If your business wishes to print labels from its own mobile application, this is a perfect example to show how seamless the integration can appear when fully completed!


Setup

A brief tutorial is provided below to help you get started with the Brady SDK in a .NET MAUI application. This will guide you through the setup process, including how to register the SDK and use its features. However, a full demo app is available to download at https://sdk.bradyid.com/bindings/

You must register the Brady SDK during dependency injection. In MauiProgram.cs, simply add .UseBradySdk() on your MauiAppBuilder object. For example, your MauiProgram.cs might look like this:

using BradySdk;
using Microsoft.Extensions.Logging;

namespace BradySdkMauiApp
{
    public static class MauiProgram
    {
        public static MauiApp CreateMauiApp()
        {
            var builder = MauiApp.CreateBuilder();
            builder
                .UseMauiApp<App>()
                .UseBradySdk()
                .ConfigureFonts(fonts =>
                {
                    fonts.AddFont("OpenSansRegular.ttf", "OpenSansRegular");
                    fonts.AddFont("OpenSansSemibold.ttf", "OpenSansSemibold");
                });

            builder.Services.AddSingleton<MainPage> ();

#if DEBUG
            builder.Logging.AddDebug();
#endif

            return builder.Build();
        }
    }
}

Now, as long as you've registered a page correctly on your MauiAppBuilder object, you'll be able to inject an IBradySdk object to the contructor like:

//Demo app's MainPage.cs file
private readonly IBradySdk bradySdk;
public MainPage(IBradySdk bradySdkService)
{
    bradySdk = bradySdkService;
    this.InitializeComponent();
}

Lastly, you may call every API method in the Brady SDK on this object. Please refer to the .NET MAUI API page for documentation. This includes the custom events that MUST be subscribed to in order to interactive bidirectional with the SDK. To subscribe to this events, do this in the constructor:

bradySdk.PrinterDiscoveredEvent += HandlePrinterDiscovery;
bradySdk.PrinterRemovedEvent += HandlePrinterRemoval;
bradySdk.PrinterUpdateEvent += HandlePrinterUpdates;

The Handle methods may look something like this:

private void HandlePrinterDiscovery(object? sender, DiscoveredPrinterInformation printer)
{
	//Add discovered printer to a global variable
    printerList.Add(printer);

    string printerListString = "";
    foreach(DiscoveredPrinterInformation dpi in printerList)
    {
        printerListString += dpi.Name + "\n";
    }

	//Update UI control to display the newly discovered printer
    MainThread.BeginInvokeOnMainThread(() =>
    {
        printerText.Text = printerListString;
    });
}

private void HandlePrinterRemoval(object? sender, DiscoveredPrinterInformation printer)
{
	//Remove the printer from the global variable
    printerList.RemoveAll(item =>
        item.Name == printer.Name && item.ConnectionType == printer.ConnectionType);

	//Rebuild the full printer list and update the UI to reflect the update.
    string printerListString = "";
    foreach (DiscoveredPrinterInformation dpi in printerList)
    {
        printerListString += dpi.Name + "\n";
    }

    MainThread.BeginInvokeOnMainThread(() =>
    {
        printerText.Text = printerListString;
    });
}

private void HandlePrinterUpdates(object? sender, IEnumerable<PrinterProperties> updates)
{
    MainThread.BeginInvokeOnMainThread(() =>
    {
        foreach (PrinterProperties update in updates)
        {
			//For updates that match the CurrentStatus property, update the UI with the new Status properties
            if (update.ToString() == "CurrentStatus")
            {
                printerDetailsText.Text = bradySdk.PrinterStatusMessage;
				//Add more elements to fully display all status properties
            }
			// Add more if statements or a switch to handle all possible PrinterProperties to be 100% thorough
        }
    });
}

You may then connect to one of these DiscoveredPrinterInformation object with the following code. Please note how the custom exceptions are used to catch any possible error. This is also an example of the most efficient way to automatically connect to a previously connected printer:

private async void Connect_To_Printer(object sender, EventArgs e)
{
    DiscoveredPrinterInformation? printerToConnectTo = null;
    try
    {
        if (bradySdk.LastConnectedPrinterName != null)
        {
            // Attempt to connect to the last connected printer
            bool connected = await bradySdk.ConnectToPrinterAsync(null);
            Console.WriteLine((connected ? "Successful" : "Failed") +
                " connection to printer: " + bradySdk.PrinterName + " with connection type: " + bradySdk.ConnectionType);
        }
        else
        {
            // Attempt to connect to a specific printer by name and connection type
            printerToConnectTo = printerList.FirstOrDefault(printer => printer.Name == "M211-PGM2112130501026" && printer.ConnectionType == ConnectionType.BLE); ;
            if (printerToConnectTo != null)
            {
                bool connected = await bradySdk.ConnectToPrinterAsync(printerToConnectTo);
                Console.WriteLine((connected ? "Successful" : "Failed") +
                    " connection to printer: " + bradySdk.PrinterName + " with connection type: " + bradySdk.ConnectionType);
            }
            else
            {
                Console.WriteLine("No printer found with the specified name and connection type.");
            }
        }
    }
    catch (PrinterConnectionException ex)
    {
        Console.WriteLine(ex.Source + ": " + ex.Message + "\n" + ex.StackTrace);
    }
    catch (SdkApiException ex)
    {
        Console.WriteLine(ex.Message);
    }
    catch (Exception ex)
    {
        Console.WriteLine("Error connecting to printer: " + ex.Message);
    }
}

If the connection was successful, you will now be able to call IBradySdk Properties to see details about the connected printer. Please note that many of these will be null before a successful connection OR if the printer model does not support the property. You can simply use the "IBradySdk.GetPrinterDetails" method to return a string of the full list of printer properties.

To print, the "SetTemplateWithFilePath" or the "SetTemplateWithBase64" must be used first to set the image/template that should be printed. You may set placeholders accordingly in a BWT file like:

bradySdk.SetTemplateWithFilePath("xam_sdk_2.BWT");
bradySdk.SetPlaceholderValue("TEXT 1", "Hello World");

Once the desireable print content is set, the "PrintAsync" method can now be used to print like:

private async void Print_Template(object sender, EventArgs e)
{
    try
    {
        PrintingStatus result = await bradySdk.PrintAsync(1, CutOption.EndOfLabel, false, true);
    }
    catch (PrintingException ex)
    {
        Console.WriteLine("Error printing template: " + ex.Message);
    }
    catch (SdkApiException ex)
    {
        Console.WriteLine("SDK API Error: " + ex.Message);
    }
    catch (Exception ex)
    {
        Console.WriteLine("Unexpected error during printing: " + ex.Message);
    }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-android34.0 is compatible.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-ios17.2 is compatible.  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.

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
3.2.1 487 7/23/2025
3.2.0 92 7/11/2025
3.1.1 161 5/20/2025
3.1.0 146 5/19/2025
3.0.0 197 9/11/2024
2.0.0 109 8/6/2024
1.7.0 169 4/25/2024

3.2.1
- Fixed an issue where the iOS SDK would print a blank label when printing a bitmap.

3.2.0
- The goal of this release was to rework the API to behave more like our native Android and iOS SDKs, and its methods have also been renamed to match the proper naming conventions of .NET MAUI.
- Added custom object DiscoveredPrinterInformation that will represent all discovered printers.
- Added 3 events that act as callback methods that get triggered by an SDK update:
- PrinterDiscoveredEvent
- PrinterRemovedEvent
- PrinterUpdateEvent
- Added custom enumerations instead on relying on Strings passed from the SDK:
    - ConnectionType
- CutOptions
- PostPrintAccessoryType
- PrinterModel
- PrinterProperties
- PrinterStatus
- PrintingStatus
- TemplateObjectType
- Added custom exceptions:
- SdkApiExceptions is the base generic SDK Exception that the below Exceptions all derive from
    - DisconnectionException
- InvalidPlaceholderDataExceptions
- PrinterConnectionException
- PrinterDiscoveryException
- PrinterOperationException
- PrintingException
- TemplateNotLoadedException
- TemplateRenderingException
- UnsupportedPrinterException
- Added Printer Details Properties:
    - Printers
- PrinterStatus
- PrinterStatusErrorSeverity
- FirmwareVersion
- LabelLibraryVersion
- PrinterModel
- ConnectionType
- IsSupplyDirectThermal
- IsSupplyValid
- IsRibbonValid
- DotsPerInch
- PostPrintAccessoryType
- AutomaticShutdownTime
- ConnectToPrinterAsync is now async and returns the connection result as a boolean
- DisconnectAsync and DisconnectWithoutForgetAsync are now async and return a PrinterStatus
- FeedAsync, CutAsync, and SetAutomaticShutdownTimeAsync are now async and return the result of the printer operation as a boolean
- PrintAsync methods are now async and return a PrintingStatus enumeration as the result of the print operation
- Various bug fixes in the Android and iOS SDK that will release with version 3.2.0 of both native SDKs.

3.1.1
- Documentation updates and corrections for 3.1.0

3.1.0
- Added support for the i7500 printer.
- Added printer property DotsPerInch, IsSupplyDirectThermal, and PostPrintAccessoryType
- Combined APIs to allow for generic calling from a Maui App using dependency injection.
- Internal refactor of the codebase to allow for easier maintenance and future updates.

3.0.0
- Added support for the S3700 printer.
- Added support for the i5300 printer.
- Print Previews now include accurate colors to reflect the installed supply and ribbon.
- Improvements with bitmap monochromization.

2.0.0
- Updated minSdkVersion for Android to 26
- App's with a minSdkVersion below 26 will not be able to connect to any printer if the mobile device is below Android 8
- Updated Android SDK to 2.0.1 (refer to https://sdk.bradyid.com/release_notes_android/ for details)
- Updated iOS SDK to 2.0.0 (refer to https://sdk.bradyid.com/release_notes_android/ for details)
- Updated README with further setup instructions.
- Revamped PlatformExceptions:
- Version 2.0.0 of the Android and iOS included many added exception messages that help the user pinpoint the location of the error and a resolution.
- You may now wrap any API method in a try/catch block to catch SdkApiExceptions.
- iOS Changes:
- Changed getPrinters() to return a Dictionary with the printer name and how it was discovered.
- Fixed a bug where related parts weren't considered a match (i.e. comparing the supplies "M21-750" and "M21-750-499" should return true).
- Fixed bug where users could not alternate between printing bitmaps and templates. It would print the same label that was set prior.
- TemplateDataNames now returns a Dictionary with the placeholder name mapped to the type of BWS object it is.
- Replaced API methods:
- CheckForPartMismatch with the SuppliesMatch API property.
- Feed() with FeedSupply()
- Cut() with CutSupply()
- GetPreviewBase64String() with GetPreview()

- Added API methods:
- YNumber (property)
- RibbonName (property)
- RibbonRemainingPercentage (property)
- SetAutomaticShutoffTime()
- SetTemplateWithFilePath()
- SetTemplateWithBase64()
- Removed API methods:
- PrinterDetailsString (property)
- SetTemplate()

1.7.0
- The first version of the MAUI wrapper that will be produced internally. This package includes everything supported in the BradyCorp.Xamarin.SDK NuGet package version 1.7.0