Generate Barcode using C#

条形码在产品识别中起着关键作用,提供机器可读的数据代表性。 常见格式如 Code 128, QRData MatrixAztec在各个行业广泛使用。 在此指南中,您将发现 如何在C#中创建条代码并轻松地使用强大的设计来定制其设计。 ASPOSE.BarCode 插件.

内容表

C# Barcode Generator API - 免费下载

Aspose.BarCode for .NET 图书馆是一个全面的 API 设计为条码生成和扫描,使其理想的 C# Free Barcode Generator. 它允许您创建和阅读各种条码符号,包括:

  • 第128章
  • 代码11
  • 代码39
  • QR
  • 数据矩阵
  • 伊恩13
  • 艾安8
  • ITF 14
  • PDF 第417集
  • 很多更多.

你可以 下载 API 免费,或直接安装在您的 .NET 应用程序使用 诺基亚 对于一个 C# Barcode Generator NuGet Free 解决方案:

PM> Install-Package Aspose.Barcode

如何使用 C# 创建条形码

使用 Aspose 插件创建条形码是简单而有效的,请遵循以下步骤,使用 C# 创建条形码,使用 Barcode Generator C# Source Code:

  • 即时启动 Barcode 发电机 类,指定所需的条码类型和文本在制造商。
  • 设置条码的功能,如分辨率和大小。
  • 创建条形码,使用 標籤:Save(String) 方法。

下面是一个代码样本,展示如何使用 .NET Barcode Generator 创建条形码:

BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code128, "Aspose.BarCode");
// set resolution
generator.Parameters.Resolution = 400;
// generate barcode
generator.Save("generate-barcode.png");
Generate Barcode in C#

如何使用 C# 创建 QR 条形码

创建一个QR条码跟随类似的过程,以产生其他条码类型。

  • 即时启动 BarcodeGenerator 分类,指定条形码类型为 标签:QR.
  • 创建条形码,使用 BarcodeGenerator.Save(String) 方法。

下面是一个代码样本,以使用 Barcode 应用程序在 C# .NET 中创建一个 QR 条码:

BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, "Aspose.BarCode");
// set resolution
generator.Parameters.Resolution = 400;
// generate barcode
generator.Save("generate-barcode.png");
Generate QR Barcode in C#

在 C# 中自定义条码的出现

使用 Aspose Plugin 轻松自定义条形码的外观,您可以修改字体、前方颜色、背景颜色和文本颜色。

  • 即时启动 BarcodeGenerator 班级。
  • 调整条形码的外观,使用 BarcodeGenerator.Parameters 属性,如 BarcodeGenerator.Parameters.BackColor。.
  • 创建条形码,使用 BarcodeGenerator.Save(String).

这里是一个代码样本,以创建个性化 Aztec 使用 Barcode Generator C# 的条形码:

BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Aztec, "Aspose.BarCode");
// set barcode's back color
generator.Parameters.BackColor = System.Drawing.Color.DarkGray;
// set barcode's bar color
generator.Parameters.Barcode.BarColor = System.Drawing.Color.Orange;
// set border color
generator.Parameters.Border.Color = System.Drawing.Color.Black;
// set text color
generator.Parameters.Barcode.CodeTextParameters.Color = System.Drawing.Color.Orange;
// set resolution
generator.Parameters.Resolution = 400;
// generate barcode
generator.Save("generate-barcode.png");
Generate Aztec Barcode in C#

添加字符串到字符串中使用 C#

将字符串集成到条码中可以提供额外的背景,而Aspose Plugin使这个过程无缝。

  • 即时启动 BarcodeGenerator 班级。
  • 在构建器中设置条码的文本和类型 Barcode 发电机.
  • 使用它 CaptionAboveCaptionBelow 设置标签的属性。
  • 保存条形码使用 BarcodeGenerator.Save(String) 方法。

下面是一个代码样本,用 C# Barcode Generator 添加一个字符号:

BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code128, "Aspose.BarCode");
// set captions
generator.Parameters.CaptionAbove.Text = "The caption above.";
generator.Parameters.CaptionAbove.Visible = true;
generator.Parameters.CaptionBelow.Text = "The caption below.";
generator.Parameters.CaptionBelow.Visible = true;
// generate barcode
generator.Save("generate-barcode.png");
Generate Barcode with Caption in C#

结论

在这篇文章中,你学会了如何使用 C# 编程生成条形码。 你还研究了怎样自定义它们的外观和添加字符串。 Aspose.BarCode 插件文档 通过 .NET Core Barcode Generator 选项提高条码生成能力. 此外,您还可以探索如何在 C# Windows 应用程序中创建条代码,并使用其他功能,如 C# 条形码扫描器 API 和 c# Barkod 发明器 Open Source 为全面的条密码解决方案。

您还可以看到如何使用 ASP.NET Barcode Generator Free 并发现 ** ASP .NET 核心条码发明器** 为创建多种条形码的效率。 无论您需要一个 C# 代码和阅读器 或 ** C# Create Bar Code Image 的工具,还有许多工具可帮助您有效地生成条形式。

最后,使用 ASP.NET MVC Barcode Generator,您可以轻松地将条码生成集成到您的网页应用程序中,为您的业务需求提供坚实的解决方案。

More in this category