BrowserPrint.Blazor 0.0.2

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

BrowserPrint.Blazor

.NET Test NuGet Version

BrowserPrint.Blazor

Run

dotnet add package BrowserPrint.Blazor

BrowserPrintProvider

Communication is done via JavaScript interop, so we need a component to handle the calls. Add the BrowserPrintProvider component to your page where you want to print. You can add this to your App.razor or MainLayout.razor file to make it available to all pages.

@inherits LayoutComponentBase
@using BrowserPrint

<BrowserPrintProvider />

@Body

BrowserPrintService

The BrowserPrintService is the service we use to interact with the printer. You can inject this service into your components.

First, call AddBrowserPrint in your Startup.

builder.Services.AddBrowserPrint();

Then inject the service into your component.

[Inject]
public BrowserPrintService BrowserPrintService { get; set; }

Printers

To get a list of printers, you can use the GetAvailablePrintersAsync method on the BrowserPrintService.

var printers = await BrowserPrintService.GetAvailablePrintersAsync();

Print

To print a document, you can use the Print method on the BrowserPrintService.

await BrowserPrintService.PrintAsync(printer, "^XA\n^BY2,2,100\n^FO20,20^BC^FD$123^FS\n^XZ");
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
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
0.0.2 462 3/25/2025
0.0.1 453 3/25/2025