alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class SfQRCodeGenerator

    Specifies all the properties for the QRCode to be rendered.

    Inheritance
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    SfBaseComponent
    SfQRCodeGenerator
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.Assets
    ComponentBase.AssignedRenderMode
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.OnAfterRender(bool)
    ComponentBase.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    ComponentBase.ShouldRender()
    ComponentBase.StateHasChanged()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    OwningComponentBase.IsDisposed
    OwningComponentBase.ScopedServices
    SfBaseComponent.Dispose()
    SfBaseComponent.Dispose(bool)
    SfBaseComponent.GetEffectivePlatform()
    SfBaseComponent.GetMainComponentPlatform()
    SfBaseComponent.IsMainLicenseComponent()
    SfBaseComponent.LicenseContext
    SfBaseComponent.OnObservableChange(string, object, bool, NotifyCollectionChangedEventArgs)
    SfBaseComponent.ValidateLicense()
    Namespace: Syncfusion.Blazor.BarcodeGenerator
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfQRCodeGenerator : SfBaseComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    Examples
    <SfQRCodeGenerator Width="200" Height="200" Version="QRCodeVersion.Version40" Value="65213323"  BackgroundColor="white" ForeColor="black" OnValidationFailed="@OnInvalid">
     <QRCodeGeneratorDisplayText Text = "" Font="monospace" Size="25" Alignment="Alignment.Left" Position="TextPosition.Top">
        <QRCodeTextMargin Left = "0" Top="0" Right="0" Bottom="0"></QRCodeTextMargin>
     </QRCodeGeneratorDisplayText>
     <QRMargin Left = "10" Top="10" Right="10" Bottom="10"></QRMargin>
    </SfQRCodeGenerator>
    @code{
     public void OnInvalid(ValidationFailedEventArgs args)
     {
     }
    }

    Constructors

    SfQRCodeGenerator()

    Declaration
    public SfQRCodeGenerator()

    Properties

    BackgroundColor

    Specifies the background color of the QRCode. By default, it is set to white.

    Declaration
    [Parameter]
    public string BackgroundColor { get; set; }
    Property Value
    Type Description
    string

    Accepts the string value representing a CSS color code for the background color of qr code. The default value is white.

    ChildContent

    Sets content for QRCode generator element including HTML support and its customizations.

    Declaration
    [Parameter]
    public RenderFragment ChildContent { get; set; }
    Property Value
    Type Description
    RenderFragment

    Accepts a RenderFragment that defines the content of the UI element.

    DisplayText

    Specifies the text properties for the QRCode.

    Declaration
    [Parameter]
    public QRCodeGeneratorDisplayText DisplayText { get; set; }
    Property Value
    Type Description
    QRCodeGeneratorDisplayText

    Displays a customized text of QR code.

    ErrorCorrectionLevel

    Specifies the error correction level of the QR code.

    Declaration
    [Parameter]
    public ErrorCorrectionLevel ErrorCorrectionLevel { get; set; }
    Property Value
    Type Description
    ErrorCorrectionLevel

    Displays the error correction level. The default error correction level is low.

    ForeColor

    Specifies the line and text color of the QRCode. By default, it is set to black.

    Declaration
    [Parameter]
    public string ForeColor { get; set; }
    Property Value
    Type Description
    string

    Accepts the string value. The default value is black.

    Height

    Specifies the height of the QRCode model. By default, it is set to 100%.

    Declaration
    [Parameter]
    public string Height { get; set; }
    Property Value
    Type Description
    string

    Accepts the string value. The default value is 100%.

    Logo

    Gets or sets the logo image that will be displayed in the center of the QR code.

    Declaration
    [Parameter]
    public QRCodeLogo Logo { get; set; }
    Property Value
    Type
    QRCodeLogo
    Examples

    The following example demonstrates how to set a logo for the QR code in Razor syntax:

    <SfQRCodeGenerator Width="150px" Height="150px" Value="Syncfusion">
        <QRCodeLogo Width="50" Height="50" ImageSource="images/syncfusion.png"></QRCodeLogo>
    </SfQRCodeGenerator>

    Margin

    Specifies the margin properties for the QRCode. By default, it is set to 10 from all sides.

    Declaration
    [Parameter]
    public QRMargin Margin { get; set; }
    Property Value
    Type Description
    QRMargin

    The margin of qr matrix code, represented as a QRMargin object. The default value of all side is 10.

    OnValidationFailed

    Triggers when the QRCode input is an invalid string.

    Declaration
    [Parameter]
    public EventCallback<ValidationFailedEventArgs> OnValidationFailed { get; set; }
    Property Value
    Type
    EventCallback<ValidationFailedEventArgs>

    Value

    Specifies the value of the QRCode to be rendered.

    Declaration
    [Parameter]
    public string Value { get; set; }
    Property Value
    Type Description
    string

    Accepts the string value.

    Version

    Specifies the version of the QR code.

    Declaration
    [Parameter]
    public QRCodeVersion Version { get; set; }
    Property Value
    Type Description
    QRCodeVersion

    The QR code version can be set to one of the following values between 1 to 40.

    Width

    Specifies the width of the QRCode model. By default, it is set to 100%.

    Declaration
    [Parameter]
    public string Width { get; set; }
    Property Value
    Type Description
    string

    Accepts the string value. The default value is 100%.

    XDimension

    Represents the width of the smallest element.

    Declaration
    [Parameter]
    public double XDimension { get; set; }
    Property Value
    Type Description
    double

    The width of the smallest element in the qr matrix.

    Methods

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    RenderTreeBuilder __builder
    Overrides
    ComponentBase.BuildRenderTree(RenderTreeBuilder)

    Export(string, BarcodeExportType)

    Export the barcode as an image in the specified image type and downloads it in the browser.

    Declaration
    public void Export(string fileName, BarcodeExportType exportType)
    Parameters
    Type Name Description
    string fileName

    Specifies the filename of the barcode image to be download.

    BarcodeExportType exportType

    Specifies the type used to export the barcode.

    ExportAsBase64Image(BarcodeExportType)

    Export the barcode as an image in the specified image type and returns it as base64 string.

    Declaration
    public Task<string> ExportAsBase64Image(BarcodeExportType exportType)
    Parameters
    Type Name Description
    BarcodeExportType exportType
    Returns
    Type Description
    Task<string>

    Returns the base64 string value.

    OnAfterRenderAsync(bool)

    The OnAfterRenderAsync method is invoked after the SfQRCodeGenerator component has finished rendering.

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    bool firstRender

    The first time the component instance is rendered is set to true.

    Returns
    Type
    Task
    Overrides
    SfBaseComponent.OnAfterRenderAsync(bool)

    OnInitializedAsync()

    OnInitializedAsync is invoked when the SfQRCodeGenerator component is initialized.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type
    Task
    Overrides
    SfBaseComponent.OnInitializedAsync()

    OnParametersSetAsync()

    Sets the parameters for the SfQRCodeGenerator component in the render tree.

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type
    Task
    Overrides
    ComponentBase.OnParametersSetAsync()

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved