![]() |
VOOZH | about |
dotnet add package BlazorBarcodes --version 1.0.5
NuGet\Install-Package BlazorBarcodes -Version 1.0.5
<PackageReference Include="BlazorBarcodes" Version="1.0.5" />
<PackageVersion Include="BlazorBarcodes" Version="1.0.5" />Directory.Packages.props
<PackageReference Include="BlazorBarcodes" />Project file
paket add BlazorBarcodes --version 1.0.5
#r "nuget: BlazorBarcodes, 1.0.5"
#:package BlazorBarcodes@1.0.5
#addin nuget:?package=BlazorBarcodes&version=1.0.5Install as a Cake Addin
#tool nuget:?package=BlazorBarcodes&version=1.0.5Install as a Cake Tool
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:
.Net 5
PM> Install-Package BlazorBarcodes
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 rendered 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; } = "";
}
Passed to the Barcoder renderer
bool IncludeEANContentAsText
If you wish to display some sort of error message, in case of a rendering issue, pass an error template to the BarcodeComponent
<BarcodeComponent Style="width:200px;height:200px"
BarcodeType="@Type"
Content="@Content"
IncludeEANContentAsText="true">
<ErrorTemplate>
@context
</ErrorTemplate>
</BarcodeComponent>
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 net5.0 is compatible. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.