BrowserPrint.Blazor
0.0.2
dotnet add package BrowserPrint.Blazor --version 0.0.2
NuGet\Install-Package BrowserPrint.Blazor -Version 0.0.2
<PackageReference Include="BrowserPrint.Blazor" Version="0.0.2" />
<PackageVersion Include="BrowserPrint.Blazor" Version="0.0.2" />
<PackageReference Include="BrowserPrint.Blazor" />
paket add BrowserPrint.Blazor --version 0.0.2
#r "nuget: BrowserPrint.Blazor, 0.0.2"
#addin nuget:?package=BrowserPrint.Blazor&version=0.0.2
#tool nuget:?package=BrowserPrint.Blazor&version=0.0.2
BrowserPrint.Blazor
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();
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 | Versions 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. |
-
net9.0
- Microsoft.AspNetCore.Components (>= 9.0.2)
- Microsoft.JSInterop (>= 9.0.3)
- Neon.Blazor (>= 4.0.14)
- Neon.Common (>= 4.0.14)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.