.NET 的 2D 条形码生成器
引入 2D Barcode Writer for .NET
2D Barcode Writer for .NET 是一个插件,允许开发人员在其 .net 应用程序中创建2D 条形码. 本指南提供了可用的功能的概述,并解释了如何使用代码示例执行常见任务。
支持 2D 条形码类型
.NET 的 2D 条形码编写器支持多种类型的 2 D 字符码,其中包括:
- QR代码
- 数据矩阵
- PDF417
创建2D条形码
要创建一个 2D 条码,您可以使用 BarcodeGenerator
此类提供多个属性,允许您自定义条形码,如 CodeText
, EncodeTypes
,和 Resolution
.
using Aspose.BarCode;
// Create a new instance of BarcodeGenerator
BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, "https://www.example.com");
// Set the resolution of the barcode
generator.Parameters۔Resolution = 300;
// Save the barcode to an image file
generator.Save("qr_code.png", BarCodeImageFormat.Png);
定制2D条形码
您可以通过使用由 2D 条形码提供的各种属性来自定义外观。 BarcodeGenerator
例如,您可以更改条形码的背景颜色。
using Aspose.BarCode;
// Create a new instance of BarcodeGenerator
BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, "https://www.example.com");
// Set the background color of the barcode
generator.Parameters.BackColor = Color.Blue;
// Set the auto-size mode
generator.Parameters.AutoSizeMode = AutoSizeMode.Nearest;
// Save the barcode to an image file
generator.Save("qr_code.png", BarCodeImageFormat.Png);