syncfusion-blazor-barcode
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSyncfusion Blazor Barcode Generator
Syncfusion Blazor 条码生成器
Syncfusion's Blazor Barcode Generator package () provides three components for generating barcodes in Blazor applications:
Syncfusion.Blazor.BarcodeGenerator| Component | Use For |
|---|---|
| 1D linear barcodes (Code39, Code128, Codabar, etc.) |
| QR codes with optional logo embedding |
| 2D Data Matrix codes for compact encoding |
All three work in Blazor Server, Blazor WebAssembly, and Blazor Web App (.NET 8+).
Syncfusion的Blazor条码生成器包()提供三个组件,用于在Blazor应用中生成条码:
Syncfusion.Blazor.BarcodeGenerator| 组件 | 适用场景 |
|---|---|
| 一维线性条码(Code39、Code128、Codabar等) |
| 可嵌入Logo的QR码 |
| 用于紧凑编码的二维Data Matrix码 |
这三个组件均支持Blazor Server、Blazor WebAssembly和Blazor Web App(.NET 8+)。
When to Use This Skill
何时使用该技能
- User needs to render or display a barcode in a Blazor component
- User asks about QR code generation (e.g., product links, 2FA, contact cards)
- User needs Data Matrix codes (pharmaceutical, logistics, label printing)
- User is configuring ,
SfBarcodeGenerator, orSfQRCodeGeneratorSfDataMatrixGenerator - User asks about exporting a barcode as an image (JPG/PNG) or Base64
- User asks about barcode types, error correction, checksums, or validation events
- User is embedding a logo in a QR code
- 用户需要在Blazor组件中渲染或显示条码
- 用户询问QR码生成相关问题(如产品链接、双因素认证、联系人卡片)
- 用户需要生成Data Matrix码(制药、物流、标签打印场景)
- 用户正在配置、
SfBarcodeGenerator或SfQRCodeGeneratorSfDataMatrixGenerator - 用户询问如何将条码导出为图片(JPG/PNG)或Base64格式
- 用户询问条码类型、纠错机制、校验和或验证事件相关内容
- 用户需要在QR码中嵌入Logo
Navigation Guide
导航指南
Setting Up the Project
项目设置
📄 Read: references/getting-started.md
- NuGet package installation
- namespace configuration
_Imports.razor - Service registration in
Program.cs - Stylesheet and script references
- Setup for Blazor Server, WebAssembly, and Web App
- Adding the first barcode component to a page
📄 阅读: references/getting-started.md
- NuGet包安装
- 命名空间配置
_Imports.razor - 中的服务注册
Program.cs - 样式表和脚本引用
- Blazor Server、WebAssembly和Web App的设置步骤
- 在页面中添加第一个条码组件
1D Barcode Types and Configuration
一维条码类型与配置
📄 Read: references/barcode-types.md
- All supported enum values with descriptions
BarcodeType - Code39, Code39 Extended, Code11, Code32, Code93, Codabar, Code128
- Choosing the right type for your use case
- configuration
EnableCheckSum - event handling
OnValidationFailed
📄 阅读: references/barcode-types.md
- 所有受支持的枚举值及说明
BarcodeType - Code39、Code39扩展码、Code11、Code32、Code93、Codabar、Code128
- 根据使用场景选择合适的条码类型
- 配置
EnableCheckSum - 事件处理
OnValidationFailed
QR Code Generator
QR码生成器
📄 Read: references/qr-code-generator.md
- Basic QR code usage
- Error correction levels (L, M, Q, H)
- Embedding a logo image in the QR code center
- Customizing logo size
- Color, dimension, and display text customization
- event
OnValidationFailed
📄 阅读: references/qr-code-generator.md
- QR码基础用法
- 纠错等级(L、M、Q、H)
- 在QR码中心嵌入Logo图片
- 自定义Logo尺寸
- 颜色、尺寸和显示文本自定义
- 事件
OnValidationFailed
Data Matrix Generator
Data Matrix码生成器
📄 Read: references/data-matrix-generator.md
- Basic Data Matrix code usage
- Color, dimension, and display text customization
- Common use cases (pharmaceuticals, labels)
- event
OnValidationFailed
📄 阅读: references/data-matrix-generator.md
- Data Matrix码基础用法
- 颜色、尺寸和显示文本自定义
- 常见使用场景(制药、标签)
- 事件
OnValidationFailed
Exporting and Customizing Barcodes
条码导出与自定义
📄 Read: references/export-and-customization.md
- Export barcode to image file (JPG/PNG)
- Export as Base64 string
- for custom barcode color
ForeColor - /
Widthfor sizingHeight - for label text
BarcodeGeneratorDisplayText - Applies to all three generator types
📄 阅读: references/export-and-customization.md
- 将条码导出为图片文件(JPG/PNG)
- 导出为Base64字符串
- 自定义条码颜色的属性
ForeColor - 用于调整尺寸的/
Width属性Height - 用于标签文本的属性
BarcodeGeneratorDisplayText - 以上配置适用于所有三个生成器组件
Quick Start Examples
快速入门示例
1D Barcode
一维条码
razor
@using Syncfusion.Blazor.BarcodeGenerator
<SfBarcodeGenerator Width="200px" Height="150px"
Type="@BarcodeType.Code128"
Value="SYNCFUSION">
</SfBarcodeGenerator>razor
@using Syncfusion.Blazor.BarcodeGenerator
<SfBarcodeGenerator Width="200px" Height="150px"
Type="@BarcodeType.Code128"
Value="SYNCFUSION">
</SfBarcodeGenerator>QR Code
QR码
razor
@using Syncfusion.Blazor.BarcodeGenerator
<SfQRCodeGenerator Width="200px" Height="200px"
Value="https://www.syncfusion.com">
</SfQRCodeGenerator>razor
@using Syncfusion.Blazor.BarcodeGenerator
<SfQRCodeGenerator Width="200px" Height="200px"
Value="https://www.syncfusion.com">
</SfQRCodeGenerator>Data Matrix
Data Matrix码
razor
@using Syncfusion.Blazor.BarcodeGenerator
<SfDataMatrixGenerator Width="200" Height="150"
Value="SYNCFUSION">
</SfDataMatrixGenerator>razor
@using Syncfusion.Blazor.BarcodeGenerator
<SfDataMatrixGenerator Width="200" Height="150"
Value="SYNCFUSION">
</SfDataMatrixGenerator>Key Properties
关键属性
| Property | Applies To | Description |
|---|---|---|
| All | The data string to encode |
| All | Width of the barcode (px or %) |
| All | Height of the barcode (px or %) |
| | |
| All | Color of the barcode bars (e.g., |
| | Adds/validates checksum digit (default |
| | QR error recovery: Low, Medium, Quartile, High |
| All | Event triggered when |
| 属性 | 适用组件 | 说明 |
|---|---|---|
| 所有组件 | 要编码的数据字符串 |
| 所有组件 | 条码宽度(px或%) |
| 所有组件 | 条码高度(px或%) |
| | |
| 所有组件 | 条码条的颜色(例如 |
| | 添加/验证校验和数字(Code39默认值为 |
| | QR码纠错等级:Low、Medium、Quartile、High |
| 所有组件 | 当 |
Common Use Cases
常见使用场景
| Need | Component | Read |
|---|---|---|
| Product/inventory labels | | barcode-types.md |
| URL / contact / 2FA QR code | | qr-code-generator.md |
| Branded QR code with logo | | qr-code-generator.md |
| Pharmaceutical / shipping labels | | data-matrix-generator.md |
| Download barcode as image | | export-and-customization.md |
| Embed barcode in email/PDF | | export-and-customization.md |
| 需求 | 组件 | 参考文档 |
|---|---|---|
| 产品/库存标签 | | barcode-types.md |
| URL / 联系人 / 双因素认证QR码 | | qr-code-generator.md |
| 带Logo的品牌化QR码 | | qr-code-generator.md |
| 制药/运输标签 | | data-matrix-generator.md |
| 将条码下载为图片 | | export-and-customization.md |
| 在邮件/PDF中嵌入条码 | | export-and-customization.md |