ในภูมิทัศน์ดิจิตอลของวันนี้โซลูชั่นการจัดเก็บข้อมูลที่มีประสิทธิภาพและน่าเชื่อถือเป็นสิ่งสําคัญ รหัส Aztec มีรูปแบบรหัสบาร์ที่มีความจุสูงซึ่งสามารถเก็บได้จํานวนมากของข้อมูล alphanumeric ด้วยความสามารถในการแก้ไขข้อผิดพลาดที่แข็งแกร่ง คู่มือนี้จะแสดงให้เห็นว่าวิธีการสร้างและอ่านโค้ด aztec โดยใช้ Aspose.BarCode สําหรับ .NET

สร้างรหัส Aztec

การสร้างรหัส Aztec ใน C# เป็นเรื่องง่ายเนื่องจากคุณสมบัติที่แข็งแกร่งที่ให้โดย Aspose.BarCode สําหรับ .NET ด้านล่างนี้คือขั้นตอนในการสร้าง code aztec ฐาน:

คู่มือขั้นตอน

ก่อนอื่นให้แน่ใจว่าคุณได้ติดตั้งแพคเกจที่จําเป็นจาก NuGet หรือแหล่งที่ต้องการของคุณ

using Aspose.BarCode;

public void GenerateAztecCode()
{
    // Create an instance of BarCodeGenerator for Aztec symbology
    BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.Aztec);
    
    // Set the data to encode in the barcode
    generator.CodeText = "SampleData1234567890";
    
    // Save the generated Aztec code as an image file
    generator.Save("aztec_code.png", BarCodeImageFormat.Png);
}

การปรับแต่งรหัส

คุณสามารถปรับแต่งหลายด้านของรหัสบาร์เช่นขนาดสีและระดับการแก้ไขข้อผิดพลาด ตัวอย่างเช่น:

// Set the width and height of the barcode image
int width = 200;
int height = 200;
generator.GraphicsUnit = System.Drawing.GraphicsUnit.Pixel;
generator.SymbologySettings.Aztec.CodeSize = new Size(width, height);

generator.Save("custom_aztec_code.png", BarCodeImageFormat.Png);

อ่านรหัส Aztec

อ่านรหัส Aztec กลับเข้าสู่ข้อมูลเป็นเรื่องง่ายเท่ากันกับ Aspose.BarCode สําหรับ .NET ตัวอย่างต่อไปนี้แสดงให้เห็นว่าวิธีการอ่านภาพร่อง aztec ที่สร้างขึ้นและสกัดข้อความที่เข้ารหัสไว้

คู่มือขั้นตอน

เพื่ออ่านรหัส Aztec เริ่มต้นการเขียน BarCodeReader วัตถุและระบุเส้นทางไฟล์ของภาพบาร์โค้ดที่คุณต้องการ decode

using Aspose.BarCode.BarCodeRecognition;

public void ReadAztecCode()
{
    // Initialize a BarCodeReader instance for reading Aztec codes
    BarCodeReader reader = new BarCodeReader("aztec_code.png", DecodeType.Aztec);
    
    // Iterate through all detected barcodes in the image
    foreach (BarCodeResult result in reader.ReadBarCodes())
    {
        Console.WriteLine($"Decoded text: {result.CodeText}");
        Console.WriteLine($"Barcode type: {result.CodeType}");
        Console.WriteLine($"Confidence: {result.ReadingQuality}%");
    }
}

เพิ่มความสามารถในการอ่าน

เพื่อความสามารถในการอ่านที่ดีขึ้นคุณสามารถตั้งค่า BarCodeReader การใช้การตั้งค่าคุณภาพที่ปรับปรุงความแม่นยําในการตรวจจับภายใต้เงื่อนไขที่ท้าทาย

reader.QualitySettings.AllowMedianSmoothing = true;
reader.QualitySettings.MedianSmoothingWindowSize = 5;

ข้อสรุป

รหัส Aztec ให้โซลูชันที่มีประสิทธิภาพสําหรับการจัดเก็บข้อมูลที่มีศักยภาพสูงและการรับข้อมูล โดยใช้ Aspose.BarCode สําหรับ .NET ผู้พัฒนาสามารถรวมฟังก์ชั่นการสร้างรหัสและอ่านได้ง่ายลงในแอพลิเคชันของพวกเขาเพื่อให้การจัดการข้อมูลมีประสิทธิภาพและน่าเชื่อถือ

More in this category