Skip to content
Client v5: BLE, BLE Hosting, HTTP, Jobs - Linux, MacOS, & Blazor Support! Full AOT, RX on BLE only & MANY other features! Power up!

Barcodes & QR Codes

Shiny.Maui.Controls.Barcodes and Shiny.Blazor.Controls.Barcodes are separate add-on packages that render 1D and 2D barcodes — including QR codes — using ZXing.Net. The PNG path uses a pure-managed, AOT-safe encoder built into the package: no SkiaSharp, no System.Drawing — so the exact same code ships clean on iOS, Android, Mac Catalyst, Windows, and Blazor WebAssembly.

There are three ways to produce a barcode, all backed by the same encoder:

ApproachWhere it livesUse it when
MAUI viewsBarcodeView, QRCodeViewShiny.Maui.Controls.BarcodesYou want a barcode on a XAML page
Blazor componentsBarcodeView, QRCodeViewShiny.Blazor.Controls.BarcodesYou want a barcode in a Razor component (SVG or PNG)
Headless BarcodeRendererShiny.Controls.Barcodes (shared)You need raw PNG bytes / SVG / data URI with no UI — PDFs, emails, label printing, services
  • NuGet downloads for Shiny.Maui.Controls.Barcodes
  • NuGet downloads for Shiny.Blazor.Controls.Barcodes
Frameworks
.NET MAUI
Blazor
Changed files
  • MyApp/
MyApp.csproj
MyApp.csproj
1<Project Sdk="Microsoft.NET.Sdk">2	<PropertyGroup>3		<BaseTargetFramework>net10.0</BaseTargetFramework>4		<TargetFrameworks>$(TargetFrameworks);$(BaseTargetFramework)-ios</TargetFrameworks>5		<TargetFrameworks>$(TargetFrameworks);$(BaseTargetFramework)-android</TargetFrameworks>6		<!--useful for unit testing - not enabled by default since it can cause issues and callout projects that don't support target-->7		<!--<TargetFrameworks Condition="'$(CI)' != 'true'">$(TargetFrameworks);$(BaseTargetFramework)</TargetFrameworks>-->8	9		<RootNamespace>MyApp</RootNamespace>10		<SingleProject>true</SingleProject>11		<ImplicitUsings>enable</ImplicitUsings>12		<Nullable>enable</Nullable>13		<ApplicationTitle>MyApp</ApplicationTitle>14		<ApplicationId>com.companyname.app</ApplicationId>15		<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>16		<ApplicationVersion>1</ApplicationVersion>17		18		<MauiXamlInflator>SourceGen</MauiXamlInflator>19		<!--uncomment below for XAML expressions in net10-->20		<!--<EnablePreviewFeatures>true</EnablePreviewFeatures>-->2122		<MauiVersion>10.0.71</MauiVersion>23		<ShinyVersion>5.0.0</ShinyVersion>24		<ShinyControlsVersion>1.0.1-beta-0129</ShinyControlsVersion>25		<ShinyShellVersion>6.3.0</ShinyShellVersion>26		<ShinyDocumentDbVersion>9.1.0</ShinyDocumentDbVersion>27		<ShinyMauiHostingVersion>5.1.1</ShinyMauiHostingVersion>2829		<EnableAotAnalyzer>true</EnableAotAnalyzer>30        <EnableTrimAnalyzer>true</EnableTrimAnalyzer>31        <EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>3233	</PropertyGroup>3435	<!-- If you want to enable AOT for iOS, uncomment the below. Note that this will cause a significant increase in build time, but will result in faster runtime performance and smaller app size. You can also enable it for just Release builds if you prefer.36	<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' and '$(Configuration)' == 'Release'">37        <PublishAot>true</PublishAot>38    </PropertyGroup>39	-->4041	<PropertyGroup Condition="'$(TargetFramework)' != '$(BaseTargetFramework)'">42		<OutputType>Exe</OutputType>43		<UseMaui>true</UseMaui>44		<DefineConstants>$(DefineConstants);PLATFORM</DefineConstants>45	</PropertyGroup>4647	<PropertyGroup Condition="'$(TargetFramework)' == '$(BaseTargetFramework)'">48		<OutputType>Library</OutputType>49		<UseMaui>false</UseMaui>50	</PropertyGroup>5152	<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">53		<SupportedOSPlatformVersion>26.0</SupportedOSPlatformVersion>54		<TargetPlatformVersion>36</TargetPlatformVersion>55		<!--56		<EmbedAssembliesIntoApk Condition="'$(Configuration)' == 'Debug'">true</EmbedAssembliesIntoApk>57		<AndroidPackageFormats Condition="'$(Configuration)' == 'Release'">aab</AndroidPackageFormats>58		<AndroidLinkTool>r8</AndroidLinkTool>59		<AndroidLinkTool>proguard</AndroidLinkTool>60		-->61    </PropertyGroup>6263	<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' AND '$(Configuration)' == 'Debug'">64        <!--forces the simulator to pickup entitlements-->65        <EnableCodeSigning>true</EnableCodeSigning>66        <CodesignRequireProvisioningProfile>true</CodesignRequireProvisioningProfile>67        <DisableCodesignVerification>true</DisableCodesignVerification>68    </PropertyGroup>6970	<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">71		<SupportedOSPlatformVersion>15.0</SupportedOSPlatformVersion>72		<DefineConstants>$(DefineConstants);APPLE</DefineConstants>	73	</PropertyGroup>7475	<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">76		<BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />77		78		<CustomEntitlements Include="keychain-access-groups" Type="StringArray" Value="%24(AppIdentifierPrefix)$(ApplicationId)" Visible="false" />79	</ItemGroup>8081	<ItemGroup>82		<TrimmerRootDescriptor Include="Linker.xml" Condition="'$(Configuration)' == 'Release'" />8384		<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />85		<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />8687		<MauiImage Include="Resources\Images\*" />88		<MauiFont Include="Resources\Fonts\*" />89		<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />90	</ItemGroup>9192	<ItemGroup>93		<PackageReference Include="Shiny.Extensions.MauiHosting" Version="$(ShinyMauiHostingVersion)" />94		<PackageReference Include="Shiny.Maui.Controls.Barcodes" Version="$(ShinyControlsVersion)" />95		<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />96		<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.9" Condition="'$(Configuration)' == 'Debug'" />97	</ItemGroup>9899	<ItemGroup Condition="'$(TargetFramework)' != '$(BaseTargetFramework)'">100		<PackageReference Include="Shiny.Hosting.Maui" Version="$(ShinyVersion)" />101	</ItemGroup>102103</Project>
  • 13 symbologiesQRCode, Aztec, DataMatrix, Pdf417, Code128, Code39, Code93, Codabar, Ean8, Ean13, UpcA, UpcE, Itf. See Symbologies.
  • QRCodeView shortcut — locks Format = QRCode, exposes a single square Size property, and adds ErrorCorrection (Low / Medium / Quartile / High).
  • Pure-managed PNG encoder — custom zlib + CRC32 + Adler32 implementation; no SkiaSharp / System.Drawing dependency.
  • Inline SVG on Blazor — single-<path> output with shape-rendering="crispEdges", scales infinitely without aliasing, stays tiny in the DOM.
  • Configurable foreground / background colors — hex on the shared options, MAUI Color on the MAUI views, CSS strings on Blazor.
  • Headless APIBarcodeRenderer.RenderPng / RenderSvg / RenderDataUri for use from view models, services, PDF builders, etc.
  • AOT-safe — pure managed code, no dynamic codegen, no reflection-only types.
claude plugin marketplace add shinyorg/skills
claude plugin install controls@shiny
copilot plugin marketplace add https://github.com/shinyorg/skills
copilot plugin install controls@shiny
View controls Plugin
Terminal window
dotnet add package Shiny.Maui.Controls.Barcodes
xmlns:bc="http://shiny.net/maui/barcodes"

No DI registration is required — the views are plain ContentViews.

Terminal window
dotnet add package Shiny.Blazor.Controls.Barcodes
@using Shiny.Blazor.Controls.Barcodes
@using Shiny.Controls.Barcodes
<!-- 1D / 2D — pick any supported Format -->
<bc:BarcodeView Value="5901234123457"
Format="Ean13"
PixelWidth="400"
PixelHeight="150" />
<!-- QR code shortcut -->
<bc:QRCodeView Value="https://shinylib.net"
Size="300"
ErrorCorrection="High" />
<!-- SVG output (default) — crisp at any CSS size -->
<BarcodeView Value="5901234123457" Format="BarcodeFormat.Ean13" />
<!-- QR shortcut -->
<QRCodeView Value="https://shinylib.net" Size="300"
QRErrorCorrection="QRErrorCorrection.High" />
using Shiny.Controls.Barcodes;
byte[] png = BarcodeRenderer.RenderPng("https://shinylib.net", BarcodeFormat.QRCode);