Skip to content

Latest commit

 

History

253 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aspose.BarCode for .NET — Agentic Examples

Agentic, build-validated C# code examples for Aspose.BarCode for .NET covering barcode generation, recognition, and configuration across 60+ symbologies. Every example compiles and runs successfully. Includes agents.md guides optimized for AI coding agents.

About Aspose.BarCode for .NET

Aspose.BarCode for .NET is a powerful barcode generation and recognition library for .NET applications. It enables developers to generate, read, and process barcodes programmatically without any third-party dependencies.

Key capabilities:

  • Generate barcodes for 60+ symbologies including Code128, QR Code, DataMatrix, PDF417, Aztec, EAN, UPC, Code39, ITF14, and more
  • Read and recognize barcodes from images, PDFs, and memory streams
  • Control barcode appearance — size, resolution, colors, padding, rotation, and XDimension
  • Configure checksum settings per symbology
  • Export barcode images as PNG, JPEG, SVG, EMF, TIFF, and BMP
  • Embed barcodes into PDF documents, Word files, and PowerPoint presentations
  • Work with complex barcode types — Swiss QR Bill, Mailmark, HIBC LIC, GS1 Composite, MaxiCode
  • Serialize and deserialize barcode generator and reader configurations to XML

Install

dotnet add package Aspose.BarCode

Or via NuGet Package Manager:

Install-Package Aspose.BarCode

Requires .NET SDK 10.0 or later.

Statistics

Metric Value
Total Examples 1124
Categories 21
Overall Pass Rate 100.0%
Package Version Aspose.BarCode 26.7.0
Last Updated 2026-08-13

Repository Structure

agents.md
README.md
+-- barcode-appearance-customization/
+-- barcode-checksum-control/
+-- barcode-color-customization/
+-- barcode-configuration-serialization/
+-- barcode-reading-properties/
+-- barcode-recognition-basics/
+-- barcode-recognition-performance/
+-- barcode-recognition-xml-serialization/
+-- barcode-saving-and-export/
+-- barcode-size-and-resolution/
+-- barcode-text-customization/
+-- gs1-barcode-types/
+-- hibc-lic-barcode/
+-- mailmark-four-state-barcode/
+-- mailmark-two-dimensional-barcode/
+-- maxicode-barcode/
+-- one-dimensional-barcode-types/
+-- postal-barcode-types/
+-- special-barcode-recognition-settings/
+-- swiss-qr-code/
+-- two-dimensional-barcode-types/

Categories

Category Examples Pass Rate Details
Barcode Appearance Customization 30 100.0% agents.md
Barcode Checksum Control 30 100.0% agents.md
Barcode Color Customization 28 100.0% agents.md
Barcode Configuration Serialization 30 100.0% agents.md
Barcode Reading Properties 50 100.0% agents.md
Barcode Recognition Basics 75 100.0% agents.md
Barcode Recognition Performance 81 100.0% agents.md
Barcode Recognition XML Serialization 35 100.0% agents.md
Barcode Saving and Export 30 100.0% agents.md
Barcode Size and Resolution 34 100.0% agents.md
Barcode Text Customization 29 100.0% agents.md
GS1 Barcode Types 34 100.0% agents.md
HIBC LIC Barcode 35 100.0% agents.md
Mailmark Four State Barcode 29 100.0% agents.md
Mailmark Two Dimensional Barcode 34 100.0% agents.md
MaxiCode Barcode 34 100.0% agents.md
One Dimensional Barcode Types 126 100.0% agents.md
Postal Barcode Types 90 100.0% agents.md
Special Barcode Recognition Settings 48 100.0% agents.md
Swiss QR Code 28 100.0% agents.md
Two Dimensional Barcode Types 214 100.0% agents.md

Frequently Asked Questions

How do I generate a QR code (or other 2D barcode) in Aspose.BarCode for .NET?

Create a BarcodeGenerator with the symbology and text, then Save(): new BarcodeGenerator(EncodeTypes.QR, "text").Save("qr.png"). Examples for all 2D symbologies are in two-dimensional-barcode-types.

How do I read or recognize a barcode from an image?

Use BarCodeReader with DecodeType.AllSupportedTypes (or a specific type), then iterate ReadBarCodes(). BarCodeReader requires a Bitmap, not Image. See barcode-recognition-basics.

How do I enable or disable the checksum for a barcode?

Set generator.Parameters.Barcode.IsChecksumEnabled (an EnableChecksum enum, not bool) — the property lives on the Barcode sub-object, not directly on Parameters. Note: some symbologies (e.g. Code128) always require a checksum and throw BarCodeException if you try to disable it. See barcode-checksum-control.

How do I set the QR code error correction level?

generator.Parameters.Barcode.QR.ErrorLevel = QRErrorLevel.LevelH (or LevelL/LevelM/LevelQ). There is no MaskPattern property — masking is automatic. See two-dimensional-barcode-types.

How do I embed a barcode into a PDF, Word, or PowerPoint document?

Render the barcode to a MemoryStream, then embed it using the target Aspose product's own image API (Aspose.Pdf.Image, Aspose.Words Shape, Aspose.Slides Picture). Full working examples in pdf-barcode-grid-rules-adjacent categories and special-barcode-recognition-settings.

How do I export a barcode as SVG, EMF, TIFF, or another format?

Pass the desired BarCodeImageFormat to Save(), e.g. generator.Save("barcode.svg", BarCodeImageFormat.Svg). Note the evaluation (unlicensed) version restricts SVG/EMF output to Code39 only — apply a license to lift this. See barcode-saving-and-export.

How do I generate complex barcodes like Swiss QR Bill, Mailmark, or HIBC LIC?

Use ComplexBarcodeGenerator with the matching codetext object — SwissQRCodetext, HIBCLICPrimaryDataCodetext/SecondaryAndAdditionalData, or Royal Mail Mailmark types. These are NOT constructed via the plain BarcodeGenerator. See swiss-qr-code, mailmark-four-state-barcode, mailmark-two-dimensional-barcode, and hibc-lic-barcode.

Why does my barcode throw a BarCodeException at runtime even though it compiles?

Almost always an invalid codetext for the chosen symbology — e.g. Australia Post requires a valid Format Control Code and minimum length, Code128 cannot have its checksum disabled, and Swiss QR Bill requires a complete Bill object. Check the relevant category's agents.md for symbology-specific constraints before constructing the codetext.

Can these examples be used by AI coding agents like Claude, Copilot, or Cursor?

Yes — the repository ships an agents.md at root and one per category, plus .well-known/agent.json, llm.txt, and a machine-readable index.json. Point your agent at the repo's raw URLs and it can browse examples programmatically.

Do I need an Aspose.BarCode license to run these examples?

The library runs in evaluation mode without a license (with watermarks and some format/symbology restrictions, e.g. SVG/EMF export). For production use, apply a license via new License().SetLicense(path). Purchase / trial options: https://purchase.aspose.com/buy.

How to Use

Each example is a self-contained C# file. Clone the repository and run any example directly:

git clone https://github.com/aspose-barcode/agentic-net-examples.git
cd agentic-net-examples

# Navigate to a category
cd barcode-recognition-basics

# Create a console project, add the package, and run an example
dotnet new console -o ExampleRunner
cd ExampleRunner
dotnet add package Aspose.BarCode

# Copy any .cs file from the category as Program.cs and run
cp ../generate-code128-barcode-and-save-as-png.cs Program.cs
dotnet run

Example

Generate a Code128 barcode and save it as a PNG file:

using System;
using Aspose.BarCode.Generation;

class Program
{
    static void Main()
    {
        using (var generator = new BarcodeGenerator(EncodeTypes.Code128, "1234567890"))
        {
            generator.Parameters.Barcode.XDimension.Point = 2f;
            generator.Parameters.Barcode.BarHeight.Point = 50f;
            generator.Save("code128.png");
            Console.WriteLine("Barcode saved as code128.png");
        }
    }
}

Read a barcode from an image file:

using System;
using Aspose.BarCode.BarCodeRecognition;

class Program
{
    static void Main()
    {
        using (var reader = new BarCodeReader("barcode.png", DecodeType.AllSupportedTypes))
        {
            foreach (var result in reader.ReadBarCodes())
            {
                Console.WriteLine($"Type: {result.CodeTypeName}");
                Console.WriteLine($"Text: {result.CodeText}");
            }
        }
    }
}

For AI Coding Agents

This repository includes an agents.md file at the root and in each category folder. These files provide AI coding agents with:

  • Required namespaces and using directives for each category
  • Correct API property paths and patterns
  • Common pitfalls and prohibited patterns
  • Example code fragments for key operations

If you are an AI coding agent generating Aspose.BarCode for .NET code, read the relevant agents.md before generating examples to avoid common API mistakes.

Prerequisites

  • .NET SDK 10.0 or later
  • Aspose.BarCode for .NET 26.7.0 (via NuGet)

A valid Aspose license is required for production use. For evaluation, examples run without a license but output may include watermarks on generated barcode images.

Agentic .NET Ecosystem

Other Aspose products with agentic, build-validated example repositories:

Product Repository Focus
Aspose.Words for .NET aspose-words/agentic-net-examples Word processing, DOCX, mail merge
Aspose.Cells for .NET aspose-cells/agentic-net-examples Spreadsheets, Excel, charts
Aspose.HTML for .NET aspose-html/agentic-net-examples HTML conversion, DOM editing
Aspose.Imaging for .NET aspose-imaging/agentic-net-examples Image conversion, manipulation
Aspose.Slides for .NET aspose-slides/agentic-net-examples Presentations, PowerPoint
Aspose.Email for .NET aspose-email/agentic-net-examples Email, calendars, messaging
Aspose.PDF for .NET aspose-pdf/agentic-net-examples PDF creation, conversion and manipulation

Related Resources

Official Documentation

Downloads & Packages

Community & Support

Licensing & Purchase

License

All examples use Aspose.BarCode for .NET and require a valid license for production use. See licensing options.


This repository is maintained by automated code generation. For AI-friendly guidance, see agents.md. Last updated: 2026-08-13

Updated: 2026-08-13 | Examples: 1124 | Categories: 21 | Package: Aspose.BarCode 26.7.0

About

Agent-generated C# examples for Aspose.BarCode for .NET — compiled, executed, and validated by an agentic pipeline. Includes an agents.md guide for AI coding agents.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages