Substantive.Blazor.QRCode 9.4.0-build20260424r1

Substantive.Blazor.QRCode

Reusable Blazor components and helpers for generating and decoding QR codes across WebAssembly and Server workloads. The library ships with UI components (QrCodeImage, QrCodeVector) plus the QRCodeUtils encoder/decoder utilities and the configurable QRCodeConfig record for fine-grained control.

Features

  • Image and SVG components: Drop-in Razor components that render PNG (Base64) or SVG QR codes with customizable colors, sizing, and optional logos.
  • Encoder helpers: Static helpers for producing Base64 strings, SVG markup, or PNG byte arrays for storage/streaming scenarios.
  • Decoder helpers: Stream, byte-array, and file-path helpers powered by ZXing for reading QR payloads from various image formats.
  • Configurable pipeline: Central QRCodeConfig record validates colors, pixels-per-module, quiet zones, and error-correction levels so QR codes remain scannable.

Getting Started

  1. Reference the project/package from your application.
  2. Import the namespace in _Imports.razor or the relevant Razor file:
    @using Substantive.Blazor.QRCode
    
  3. Add the component that fits your scenario:
    <QrCodeImage PayloadString="https://contoso.example" PixelsPerModule="16" DarkColor="#111" LightColor="#fafafa" />
    
    <QrCodeVector PayloadString="https://contoso.example" SvgLogo="@MySvgMarkup" />
    
  4. (Optional) Use QRCodeUtils directly when you need raw PNG bytes, SVG markup, or Base64 data URIs outside of component rendering.

Components

QrCodeImage

  • Renders a PNG-based QR code (data:image/png;base64,...).
  • Parameters: PayloadString, PixelsPerModule, DarkColor, LightColor, DrawQuietZone.
  • Adds the CSS class qr-code-container for custom styling; see the component-specific .razor.css for defaults.

QrCodeVector

  • Produces an SVG data URI, ideal for responsive layouts or printing scenarios.
  • Parameters mirror QrCodeImage with the addition of SvgLogo for inserting raw SVG content in the center of the code.
  • Uses QRCodeUtils.GenerateQRCodeAsSVG under the hood.

Utilities

Encoding (QRCodeUtils.Encoder)

  • GenerateQRCodeAsBase64(...): Returns a Base64 PNG string for inline <img> or CSS usage.
  • GenerateQRCodeAsSVG(...): Produces raw SVG markup; supports sizing modes and optional SVG logo overlays.
  • GenerateQRCodeAsPng(...): Returns PNG bytes suitable for persistence or streaming.
  • GenerateQRCodeAsByteArray(...): Core method invoked by the helpers above; validates QRCodeConfig via data annotations before generation.

QRCodeConfig highlights:

Property Description
DarkColor / LightColor HEX colors validated via regex; defaults #000 / #FFF.
PixelsModuleSize Resolution control (default 20).
DrawQuietZones Keeps scanners compatible with the required border.
ErrorCorrectionLevel Defaults to Q; raise to H when branding overlaps the code.
SvgIcon Optional raw SVG used when generating SVG codes with logos.

Decoding (QRCodeUtils.Decoder)

  • ReadQRCode(Stream) / ReadQRCode(byte[]): Decode payloads from in-memory content.
  • ReadQRCode(Stream, mediaType): Enforces a specific MIME type (image/png, image/jpeg, etc.).
  • ReadQRCode(string filePath): Automatically infers the image type from the file extension.

All decoding paths validate arguments, ensure readable streams, and throw precise exceptions when a QR code cannot be decoded.

Guidance & Best Practices

  • Prefer SVG output for responsive UIs; PNG/Base64 is great for quick inline rendering.
  • Keep DrawQuietZones enabled unless you control the background color tightly.
  • Use higher ErrorCorrectionLevel when overlaying logos or expecting wear/tear.
  • When decoding user-uploaded files, validate the stream (as done in QRCodeUtils) before attempting to decode.
  • If you contribute new public APIs, accompany them with xUnit tests and update this README when needed.

Support

File issues or feature requests in the Foundation Frontends repository. For security-sensitive concerns, follow the organization’s responsible disclosure guidelines.

Showing the top 20 packages that depend on Substantive.Blazor.QRCode.

Packages Downloads
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
2
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
3
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
4
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
5
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
7
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
8
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
9
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
10
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
12
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor components.
15
Substantive.Metapackage.BlazorComponents
A metapackage contains all Blazor essential building blocks. It packed standalone Blazor components and extensions that often use such as Navigation, Exception Handling, Localization, etc,.
10

.NET 10.0

Version Downloads Last updated
9.4.0-build20260427R7 3 04/27/2026
9.4.0-build20260427R6 3 04/27/2026
9.4.0-build20260424R5 3 04/24/2026
9.4.0-build20260424R4 3 04/24/2026
9.4.0-build20260424R3 3 04/24/2026
9.4.0-build20260424R2 3 04/24/2026
9.4.0-build20260424R1 13 04/24/2026
9.4.0-build20260422R1 6 04/22/2026
9.4.0-build20260421R9 4 04/21/2026
9.4.0-build20260421R8 4 04/21/2026
9.4.0-build20260421R6 4 04/21/2026
9.4.0-build20260421R5 4 04/21/2026
9.4.0-build20260421R4 4 04/21/2026
9.4.0-build20260421R16 4 04/21/2026
9.4.0-build20260421R15 4 04/21/2026
9.4.0-build20260421R13 5 04/21/2026
9.4.0-build20260421R12 4 04/21/2026
9.4.0-build20260421R11 4 04/21/2026
9.4.0-build20260421R10 4 04/21/2026
9.4.0-build20260420R3 4 04/20/2026
9.4.0-build20260420R2 7 04/20/2026
9.4.0-build20260414R2 4 04/14/2026
9.4.0-build20260414R1 4 04/14/2026
9.4.0-build20260410R1 5 04/10/2026
9.4.0-build20260408R1 4 04/08/2026
9.4.0-build20260407R1 4 04/07/2026
9.4.0-build20260403R7 4 04/03/2026
9.4.0-build20260403R6 7 04/03/2026
9.4.0-build20260403R5 4 04/03/2026
9.4.0-build20260401R5 4 04/01/2026
9.4.0-build20260401R4 4 04/01/2026
9.4.0-build20260401R3 4 04/01/2026
9.4.0-build20260401R2 4 04/01/2026
9.4.0-build20260401R1 4 04/01/2026
9.4.0-build20260331R7 4 03/31/2026
9.4.0-build20260331R6 4 03/31/2026
9.4.0-build20260331R5 4 03/31/2026
9.4.0-build20260331R4 4 03/31/2026
9.4.0-build20260331R3 4 03/31/2026
9.4.0-build20260331R2 4 03/31/2026
9.4.0-build20260331R1 4 03/31/2026
9.4.0-build20260330R4 4 03/30/2026
9.4.0-build20260330R3 4 03/30/2026
9.4.0-build20260329R1 4 03/29/2026
9.4.0-build20260318R3 4 03/18/2026
9.4.0-build20260317R1 4 03/17/2026
9.4.0-build20260217R3 4 02/17/2026
9.4.0-build20260207R3 4 02/07/2026
9.4.0-build20260207R2 4 02/07/2026
9.4.0-build20260206R6 4 02/06/2026
9.4.0-build20260206R5 4 02/06/2026
9.4.0-build20260206R4 4 02/06/2026
9.4.0-build20260206R3 4 02/06/2026
9.4.0-build20260206R2 4 02/06/2026
9.4.0-build20260205R1 4 02/05/2026
9.4.0-build20260115R1 15 01/15/2026
9.4.0-build20260114R5 5 01/14/2026
9.4.0-build20260114R2 4 01/14/2026
9.4.0-build20260114R1 5 01/14/2026
9.4.0-build20260113R1 4 01/13/2026
9.4.0-build20260109R1 6 01/09/2026
9.4.0-build20251226R1 6 12/26/2025
9.3.3-build20251226R1 4 12/26/2025
9.3.2-build20251225R1 6 12/25/2025
9.3.0-build20251223R1 5 12/23/2025
9.2.0-build20251222R2 6 12/22/2025
9.2.0-build20251222R1 5 12/22/2025
9.1.0-build20251217R1 6 12/17/2025
9.1.0-build20251215R1 7 12/15/2025
9.1.0-build20251211R1 6 12/11/2025
9.1.0-build20251207R1 6 12/07/2025
9.1.0-build20251203R1 4 12/03/2025
9.1.0-build20251202R1 4 12/02/2025
9.1.0-build20251201R1 4 12/01/2025
9.1.0-build20251128R1 5 11/28/2025
9.0.4-build20251127R1 7 11/27/2025
9.0.4-build20251126R1 6 11/26/2025