BlazorBarcodes 1.0.0
See the version list below for details.
dotnet add package BlazorBarcodes --version 1.0.0
NuGet\Install-Package BlazorBarcodes -Version 1.0.0
<PackageReference Include="BlazorBarcodes" Version="1.0.0" />
paket add BlazorBarcodes --version 1.0.0
#r "nuget: BlazorBarcodes, 1.0.0"
// Install BlazorBarcodes as a Cake Addin #addin nuget:?package=BlazorBarcodes&version=1.0.0 // Install BlazorBarcodes as a Cake Tool #tool nuget:?package=BlazorBarcodes&version=1.0.0
BlazorBarcodes
Provides blazor component for rendering 1D & 2D codes.
This is a really simple wrapper around huysentruitw´s Barcoder and as such supports the same barcode types, which at this time are:
- 2 of 5
- Aztec Code
- Codabar
- Code 39
- Code 93
- Code 128
- Code 128 GS1
- Data Matrix (ECC 200)
- Data Matrix GS1
- EAN 8
- EAN 13
- KIX (used by PostNL)
- PDF 417
- QR Code
- RM4SC (Royal Mail 4 State Code)
- UPC A
- UPC E
Usage
Add the following using statements.
@using BlazorBarcodes
@using BlazorBarcodes.Barcodes
@using BlazorBarcodes.Encoders
Pass a string content and either a BarcodeType(enum), Encoder or encoding function to the component.
<BarcodeComponent Style="width:200px;height:200px"
BarcodeType="@BarcodeTypes.DataMatrix"
Content="Hello World!">
</BarcodeComponent>
The codes are renderer as SVG by default.
If you´d like to quickly play around with the different barcodes, you create an easy selection like this.
<div style="display:flex; flex-direction:column">
<input type="text" @bind="Content">
<select @bind="Type">
@foreach (var barcode in BarcoderWrapper.Barcodes.Barcode.All)
{
<option value="@barcode.Type" disabled="@(!barcode.Encoder.CanEncode(Content, out string error))">
@(string.Format("{0}{1}", barcode.Name, error is not null ? $": {error}" : ""))
</option>
}
</select>
<BarcodeComponent Style="width:200px;height:200px"
BarcodeType="@Type"
Content="@Content">
</BarcodeComponent>
</div>
@code {
public BarcodeTypes Type { get; set; }
public string Content { get; set; } = "";
}
Options
Passed to the Barcoder renderer
bool IncludeEANContentAsText
Shows exception message instead of the rendered code, in case the content is not compatible with the encoder
bool ShowExceptionMessages
Encoders
The encoding functions in Barcoder have been wrapped in classes implementing my own IEncoder interface, since I wanted to be able to pass encoders around and also saw it as an opportunity to play around with C# source code generators.
You can still use pass the pre-existing encode methods to the component though.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net5.0
- Barcoder.Renderer.Svg (>= 1.1.0)
- Barcodes (>= 1.0.0)
- Microsoft.AspNetCore.Components.Web (>= 5.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.