Class SfDataMatrixGenerator
Represents the data and functionalities for SfDataMatrixGenerator.
Inherited Members
Namespace: Syncfusion.Blazor.BarcodeGenerator
Assembly: Syncfusion.Blazor.dll
Syntax
public class SfDataMatrixGenerator : SfBaseComponent
Examples
<SfDataMatrixGenerator Width="200" Height="200" Value="65213323" Encoding="DataMatrixEncoding.ASCIINumeric" BackgroundColor="white" ForeColor="black" OnValidationFailed="@OnInvalid">
<DataMatrixGeneratorDisplayText Text = "" Font="monospace" Size="25" Alignment="Alignment.Left" Position="TextPosition.Top">
<DataMatrixTextMargin Left = "0" Top="0" Right="0" Bottom="0"></DataMatrixTextMargin>
</DataMatrixGeneratorDisplayText>
<DataMatrixMargin Left = "10" Top="10" Right="10" Bottom="10"></ DataMatrixMargin >
</SfDataMatrixGenerator>
@code{
public void OnInvalid(ValidationFailedEventArgs args)
{
}
}
Constructors
SfDataMatrixGenerator()
Declaration
public SfDataMatrixGenerator()
Properties
BackgroundColor
Specifies the background color of the DataMatrix. By default, it is set to white.
Declaration
public string BackgroundColor { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value representing a CSS color code for the background color of data matrix. The default value is white. |
ChildContent
Sets content for data matrix element including HTML support and its customizations.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment | Accepts a RenderFragment that defines the content of the UI element. |
DisplayText
Specifies the text properties for the DataMatrix.
Declaration
public DataMatrixGeneratorDisplayText DisplayText { get; set; }
Property Value
Type | Description |
---|---|
DataMatrixGeneratorDisplayText | Displays a customized text of data matrix code. |
Encoding
Specifies the encoding type of the DataMatrix.
Declaration
public DataMatrixEncoding Encoding { get; set; }
Property Value
Type | Description |
---|---|
DataMatrixEncoding | One of the DataMatrixEncoding enumeration values that specifies the encoding type of the DataMatrix. |
ForeColor
Specifies the line and text color of the DataMatrix. By default, it is set to black.
Declaration
public string ForeColor { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. The default value is black. |
Height
Specifies the height of the DataMatrix model. By default, it is set to 100%.
Declaration
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. The default value is |
Margin
Specifies the margin properties for the DataMatrix. By default, it is set to 10 from all sides.
Declaration
public DataMatrixMargin Margin { get; set; }
Property Value
Type | Description |
---|---|
DataMatrixMargin | The margin of data matrix code, represented as a DataMatrixMargin object. The default value of all side is |
OnValidationFailed
Triggers when the DataMatrix input is an invalid string.
Declaration
public EventCallback<ValidationFailedEventArgs> OnValidationFailed { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<ValidationFailedEventArgs> |
Size
Specifies the amount of data to be encoded in the data matrix symbol.
Declaration
public DataMatrixSize Size { get; set; }
Property Value
Type | Description |
---|---|
DataMatrixSize | The size of the data matrix symbol. |
Value
Specifies the value of the DataMatrix to be rendered.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. |
Width
Specifies the width of the DataMatrix model. By default, it is set to 100%.
Declaration
public string Width { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. The default value is |
XDimension
Represents the width of the smallest element.
Declaration
public double XDimension { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The width of the smallest element in the data matrix. |
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
Export(String, BarcodeExportType)
Export the DataMatrix 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 |
---|---|---|
System.String | fileName | Specifies the filename of the DataMatrix image to be download. |
BarcodeExportType | exportType | Specifies the type used to export the DataMatrix. |
ExportAsBase64Image(BarcodeExportType)
Export the DataMatrix 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 |
---|---|
System.Threading.Tasks.Task<System.String> | Returns the base64 string value. |
OnAfterRenderAsync(Boolean)
The OnAfterRenderAsync method is invoked after the SfDataMatrixGenerator component has finished rendering.
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender | The first time the component instance is rendered is set to true. |
Returns
Type |
---|
System.Threading.Tasks.Task |
Overrides
OnInitializedAsync()
OnInitializedAsync is invoked when the SfDataMatrixGenerator component is initialized.
Declaration
protected override Task OnInitializedAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
Overrides
OnParametersSetAsync()
Sets the parameters for the SfDataMatrixGenerator component in the render tree.
Declaration
protected override Task OnParametersSetAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |