Altbilgi içeriğine atla
DIğER BILEşENLERLE KARşıLAşTıRıN
IronBarcode ve ZXing.NET Kütüphaneleri Arasında Bir Karşılaştırma

IronBarcode ve ZXing.NET Arasında Bir Karşılaştırma

[64] Bir barkod tarayıcı bazen uygulamalarımız için uygun olmayabilir. [65] Zaten barkodun dijital bir görüntüsüne sahip olabilir ve İngilizce metin olarak neyi temsil ettiğini bilmek isteyebilirsiniz. [66] Ayrıca, bu tarayıcı yalnızca sınırlı miktarda veri içeren ve yalnızca Windows RT Sınıf kütüphanesinde kullanılabilecek 1-D barkodlarını okur. [67] 2-D barkodlar (aynı zamanda QR kodları olarak bilinir) artık yaygındır ve çok daha fazla bilgi içerebilir.

[68] Basit API çağrıları ve birkaç kod satırı kullanarak barkodları okuyacak bir C# tabanlı uygulama oluşturabilirsiniz. [69] .NET destekli bir uygulama, herhangi bir üçüncü taraf araç veya API'ye bağımlı olmadan Windows, macOS veya Linux üzerinde çalışır.

[70] Bu makale, barkodları programlı olarak okumak için en güçlü iki .NET Core uygulama kütüphanesini karşılaştıracaktır. [71] Bu iki kütüphane IronBarcode ve ZXing.NET'dir. [72] IronBarcode'un ZXing.NET'den daha güçlü ve sağlam yapan şeyleri göreceğiz.


[79] ## ZXing.NET nedir

[80] ZXing.NET, barkodları çözümleyen ve üreten (QR Code, PDF 417, EAN, UPC, Aztec, Data Matrix, Codabar gibi) bir kütüphanedir. [81] "zebra crossing" (zebra geçişi) anlamına gelen ZXing, çok çeşitli 1D ve 2D barkod formatlarını destekleyen Java tabanlı, açık kaynaklı bir kütüphanedir.

[82] Temel özellikleri şunlardır:

[83] - URL'ler, iletişim bilgileri, takvim etkinlikleri ve daha fazlasını depolama yeteneğine sahiptir [84] - Java SE uygulamalarına özel olarak uyarlanmıştır [85] - intent üzerinden barkod tarayıcı entegrasyonuna izin verir [86] - basit bir Google Glass uygulamasıdır

[87] ## IronBarcode Nedir

[88] IronBarcode, programcıların barkodları okuyup üretmelerine olanak tanıyan bir C# kütüphanesidir. [89] Önde gelen bir barkod kütüphanesi olarak, IronBarcode, dekoratif (renkli ve markalı) QR kodlar da dahil olmak üzere geniş bir yelpazede 1 boyutlu ve 2 boyutlu barkodları destekler. [90] .NET Standard ve Core Sürüm 2 ve üzerini destekleyerek, onu Azure, Linux, macOS, Windows ve Web'de platformlar arası kullanılabilir hale getirir. [91] IronBarcode, C#, VB.NET ve F# geliştiricilerinin standart programlama dilleriyle çalışmasına olanak tanıyan .NET sistemi için tanınmış bir sınıf kütüphanesi veya bileşenidir. [92] Müşterilerin tarayıcı etiketlerini tarayıp yeni standart etiketler oluşturmasına olanak tanır. [93] 2D barkodlar ve diğer 3D standart barkodlarla çok iyi çalışır.

[94] IronBarcode şimdi 2D barkodları destekliyor. [95] Bu kodların renklendirilmesini, stilizasyonunu ve pikselleştirilmesini optimize etme işlevselliği sağlar ve baskı veya reklam materyali için logolar ekleme imkanı sunar. [96] Bu kütüphane ayrıca diğer barkod yazılımlarının okuyamayabileceği eğilmiş ve deforme olmuş barkodları okuyabilir.

[97] ## IronBarcode ve ZXing.NET Kurulumu

[98] ### ZXing.NET Kurulumu

[99] ZXing.NET kütüphanesini kullanmak için, ASP.NET Core uygulamanıza NuGet Paket Yöneticisi Konsolu'nu kullanarak aşağıdaki iki paketi yükleyin:

[100] #### 1. ZXing.Net

Install-Package ZXing.Net

2. ZXing.Net.Bindings.CoreCompat.System.Drawing

Install-Package ZXing.Net.Bindings.CoreCompat.System.Drawing -Version 0.16.5-beta

Alternatif olarak, ZXing.NET'i projenize NuGet Paket Yöneticisi kullanarak yükleyin. Bunu yapmak için Tools > NuGet Paket Yöneticisi > Çözümler için NuGet paketlerini yönet... sekmesine gidin, ardından "Browse" sekmesine geçin ve "ZXing.NET" arayın.

A Comparison between IronBarcode and Zxing.NET, Figure 1: ASP.NET Web Uygulaması

ASP.NET Web Uygulaması

IronBarcode Kurulumu

IronBarcode'u NuGet Paket Yöneticisi kullanarak veya DLL dosyasını doğrudan ürün web sitesi üzerinden indirerek yükleyin. IronBarcode ad alanı tüm IronBarcode sınıflarını içerir.

IronBarcode, Visual Studio için NuGet Paket Yöneticisi kullanılarak yüklenebilir: paket adı "Barcode".

Install-Package BarCode

2D Barkod Oluşturma

ZXing.NET Kullanarak

İlk olarak, proje dosyasının kök klasörü içinde 'qrr' adlı yeni bir klasör oluşturun.

Daha sonra QR dosyaları oluşturacak ve 'qrr' klasörü içinde görüntü sistem dosyalarını depolayacağız.

Controller içinde, aşağıda kaynak kodunda gösterildiği gibi GenerateFile() metodunu ekleyin.

public ActionResult GenerateFile()
{
    return View();
}

[HttpPost]
public ActionResult GenerateFile(string qrText)
{
    Byte [] byteArray;
    var width = 250; // width of the QR Code
    var height = 250; // height of the QR Code
    var margin = 0;

    // BarcodeWriterPixelData acts as a QR code generator
    var qrCodeWriter = new ZXing.BarcodeWriterPixelData
    {
        Format = ZXing.BarcodeFormat.QR_CODE,
        Options = new QrCodeEncodingOptions
        {
            Height = height,
            Width = width,
            Margin = margin
        }
    };
    var pixelData = qrCodeWriter.Write(qrText);

    // creating a PNG bitmap from the raw pixel data; if only black and white colors are used it makes no difference if the raw pixel data is BGRA oriented and the bitmap is initialized with RGB
    using (var bitmap = new System.Drawing.Bitmap(pixelData.Width, pixelData.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb))
    {
        using (var ms = new MemoryStream())
        {
            var bitmapData = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, pixelData.Width, pixelData.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
            try
            {
                // we assume that the row stride of the bitmap is aligned to 4 byte multiplied by the width of the image
                System.Runtime.InteropServices.Marshal.Copy(pixelData.Pixels, 0, bitmapData.Scan0, pixelData.Pixels.Length);
            }
            finally
            {
                bitmap.UnlockBits(bitmapData);
           }

            // Save to folder
            string fileGuid = Guid.NewGuid().ToString().Substring(0, 4);
            bitmap.Save(Server.MapPath("~/qrr") + "/file-" + fileGuid + ".png", System.Drawing.Imaging.ImageFormat.Png);

            // Save to stream as PNG
            bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            byteArray = ms.ToArray();
        }
    }
    return View(byteArray);
}
public ActionResult GenerateFile()
{
    return View();
}

[HttpPost]
public ActionResult GenerateFile(string qrText)
{
    Byte [] byteArray;
    var width = 250; // width of the QR Code
    var height = 250; // height of the QR Code
    var margin = 0;

    // BarcodeWriterPixelData acts as a QR code generator
    var qrCodeWriter = new ZXing.BarcodeWriterPixelData
    {
        Format = ZXing.BarcodeFormat.QR_CODE,
        Options = new QrCodeEncodingOptions
        {
            Height = height,
            Width = width,
            Margin = margin
        }
    };
    var pixelData = qrCodeWriter.Write(qrText);

    // creating a PNG bitmap from the raw pixel data; if only black and white colors are used it makes no difference if the raw pixel data is BGRA oriented and the bitmap is initialized with RGB
    using (var bitmap = new System.Drawing.Bitmap(pixelData.Width, pixelData.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb))
    {
        using (var ms = new MemoryStream())
        {
            var bitmapData = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, pixelData.Width, pixelData.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
            try
            {
                // we assume that the row stride of the bitmap is aligned to 4 byte multiplied by the width of the image
                System.Runtime.InteropServices.Marshal.Copy(pixelData.Pixels, 0, bitmapData.Scan0, pixelData.Pixels.Length);
            }
            finally
            {
                bitmap.UnlockBits(bitmapData);
           }

            // Save to folder
            string fileGuid = Guid.NewGuid().ToString().Substring(0, 4);
            bitmap.Save(Server.MapPath("~/qrr") + "/file-" + fileGuid + ".png", System.Drawing.Imaging.ImageFormat.Png);

            // Save to stream as PNG
            bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            byteArray = ms.ToArray();
        }
    }
    return View(byteArray);
}
Public Function GenerateFile() As ActionResult
	Return View()
End Function

<HttpPost>
Public Function GenerateFile(ByVal qrText As String) As ActionResult
	Dim byteArray() As Byte
	Dim width = 250 ' width of the QR Code
	Dim height = 250 ' height of the QR Code
	Dim margin = 0

	' BarcodeWriterPixelData acts as a QR code generator
	Dim qrCodeWriter = New ZXing.BarcodeWriterPixelData With {
		.Format = ZXing.BarcodeFormat.QR_CODE,
		.Options = New QrCodeEncodingOptions With {
			.Height = height,
			.Width = width,
			.Margin = margin
		}
	}
	Dim pixelData = qrCodeWriter.Write(qrText)

	' creating a PNG bitmap from the raw pixel data; if only black and white colors are used it makes no difference if the raw pixel data is BGRA oriented and the bitmap is initialized with RGB
	Using bitmap = New System.Drawing.Bitmap(pixelData.Width, pixelData.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb)
		Using ms = New MemoryStream()
			Dim bitmapData = bitmap.LockBits(New System.Drawing.Rectangle(0, 0, pixelData.Width, pixelData.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb)
			Try
				' we assume that the row stride of the bitmap is aligned to 4 byte multiplied by the width of the image
				System.Runtime.InteropServices.Marshal.Copy(pixelData.Pixels, 0, bitmapData.Scan0, pixelData.Pixels.Length)
			Finally
				bitmap.UnlockBits(bitmapData)
			End Try

			' Save to folder
			Dim fileGuid As String = Guid.NewGuid().ToString().Substring(0, 4)
			bitmap.Save(Server.MapPath("~/qrr") & "/file-" & fileGuid & ".png", System.Drawing.Imaging.ImageFormat.Png)

			' Save to stream as PNG
			bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png)
			byteArray = ms.ToArray()
		End Using
	End Using
	Return View(byteArray)
End Function
$vbLabelText   $csharpLabel

Geride kalan tek değişiklik, QR kod dosyasını 'qrr' klasörü içinde kaydetmektir. Bu, aşağıdaki iki kod satırı kullanılarak yapılır.

string fileGuid = Guid.NewGuid().ToString().Substring(0, 4);
bitmap.Save(Server.MapPath("~/qrr") + "/file-" + fileGuid + ".png", System.Drawing.Imaging.ImageFormat.Png);
string fileGuid = Guid.NewGuid().ToString().Substring(0, 4);
bitmap.Save(Server.MapPath("~/qrr") + "/file-" + fileGuid + ".png", System.Drawing.Imaging.ImageFormat.Png);
Dim fileGuid As String = Guid.NewGuid().ToString().Substring(0, 4)
bitmap.Save(Server.MapPath("~/qrr") & "/file-" & fileGuid & ".png", System.Drawing.Imaging.ImageFormat.Png)
$vbLabelText   $csharpLabel

Sonraki adımda, GenerateFile görünümünü oluşturmalı ve aşağıdaki kodu ona eklemelisiniz. GenerateFile görünümü, Index görünümü ile aynıdır.

@model Byte []
@using (Html.BeginForm(null, null, FormMethod.Post))
{
    <table>
        <tbody>
            <tr>
                <td>
                    <label>Enter text for creating QR Code</label>
                </td>
                <td>
                <input type="text" name="qrText" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <button>Submit</button>
                </td>
            </tr>
        </tbody>
    </table>
}
@{
    if (Model != null)
    {
        <h3>QR Code Successfully Generated</h3>
        <img src="@String.Format("data:image/png;base64,{0}", Convert.ToBase64String(Model))" />
    }
}
@model Byte []
@using (Html.BeginForm(null, null, FormMethod.Post))
{
    <table>
        <tbody>
            <tr>
                <td>
                    <label>Enter text for creating QR Code</label>
                </td>
                <td>
                <input type="text" name="qrText" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <button>Submit</button>
                </td>
            </tr>
        </tbody>
    </table>
}
@{
    if (Model != null)
    {
        <h3>QR Code Successfully Generated</h3>
        <img src="@String.Format("data:image/png;base64,{0}", Convert.ToBase64String(Model))" />
    }
}
model Function [using](Html.BeginForm ByVal As (Nothing, Nothing, FormMethod.Post)) As Byte()
'INSTANT VB WARNING: An assignment within expression was extracted from the following statement:
'ORIGINAL LINE: <table> <tbody> <tr> <td> <label> Enter text for creating QR Code</label> </td> <td> <input type="text" name="qrText" /> </td> </tr> <tr> <td colspan="2"> <button> Submit</button> </td> </tr> </tbody> </table>
	"qrText" /> </td> </tr> (Of tr) <td colspan="2"> (Of button) Submit</button> </td> </tr> </tbody> </table>
'INSTANT VB WARNING: An assignment within expression was extracted from the following statement:
'ORIGINAL LINE: <table> <tbody> <tr> <td> <label> Enter text for creating QR Code</label> </td> <td> <input type="text" name="qrText" /> </td> </tr> <tr> <td colspan
	"text" name="qrText" /> </td> </tr> (Of tr) <td colspan
	(Of table) (Of tbody) (Of tr) (Of td) (Of label) Enter text for creating QR Code</label> </td> (Of td) <input type="text" name
End Function
@
If True Then
	If Model IsNot Nothing Then
'INSTANT VB WARNING: Instant VB cannot determine whether both operands of this division are integer types - if they are then you should use the VB integer division operator:
		(Of h3) QR Code Successfully Generated</h3> <img src="@String.Format("data:image/png
		base64,
		If True Then
			0
		End If
		", Convert.ToBase64String(Model))" />
	End If
End If
$vbLabelText   $csharpLabel

Metin kutusuna herhangi bir değer girin ve 'Gönder' düğmesine tıklayın. QR Kodu oluşturulacak ve 'qrr' klasörüne .PNG dosyası olarak kaydedilecektir.

A Comparison between IronBarcode and ZXing.NET, Figure 2: QR Kod Oluşturucu

QR Kod Oluşturucu

A Comparison between IronBarcode and ZXing.NET, Figure 3: QR Kod Dosyaları Gösteriliyor

QR Kod Dosyaları Gösteriliyor

Desteklenen Barkod Formatları

IronBarcode, aşağıdakiler dahil olmak üzere yaygın olarak kullanılan birçok barkod formatını destekler:

  • Logolar ve renkler içeren QR kodları (süslenmiş ve markalı kodlar dahil)
  • Aztek, Data Matrix, CODE 93, CODE 128, RSS Genişletilmiş Databar, UPS MaxiCode ve USPS, IMB (OneCode) barkodları dahil olmak üzere çok formatlı barkodlar
  • RSS-14 ve PDF-417 yığılmış lineer barkodlar
  • UPCA, UPCE, EAN-8, EAN-13, Codabar, ITF, MSI ve Plessey geleneksel sayısal barkod formatlarıdır.

Barkod Oluşturma ve Kaydetme

using IronBarCode;
// Create a barcode and save it in various formats
var MyBarCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeEncoding.Code128);
MyBarCode.SaveAsImage("MyBarCode.png");
MyBarCode.SaveAsGif("MyBarCode.gif");
MyBarCode.SaveAsHtmlFile("MyBarCode.html");
MyBarCode.SaveAsJpeg("MyBarCode.jpg");
MyBarCode.SaveAsPdf("MyBarCode.Pdf");
MyBarCode.SaveAsPng("MyBarCode.png");
MyBarCode.SaveAsTiff("MyBarCode.tiff");
MyBarCode.SaveAsWindowsBitmap("MyBarCode.bmp");

// Convert barcode to different image formats and obtain binary data
System.Drawing.Image MyBarCodeImage = MyBarCode.Image;
System.Drawing.Bitmap MyBarCodeBitmap = MyBarCode.ToBitmap();
string DataURL = MyBarCode.ToDataUrl();
string ImgTagForHTML = MyBarCode.ToHtmlTag();
byte[] PngBytes = MyBarCode.ToPngBinaryData();

// Save barcode in PDF stream
using (System.IO.Stream PdfStream = MyBarCode.ToPdfStream())
{
    // The Stream barcode image output also works for GIF, JPEG, PDF, PNG, BMP and TIFF
}

// Stamp barcode onto an existing PDF at a specific position
MyBarCode.StampToExistingPdfPage("ExistingPDF.pdf", 1, 200, 50);
using IronBarCode;
// Create a barcode and save it in various formats
var MyBarCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeEncoding.Code128);
MyBarCode.SaveAsImage("MyBarCode.png");
MyBarCode.SaveAsGif("MyBarCode.gif");
MyBarCode.SaveAsHtmlFile("MyBarCode.html");
MyBarCode.SaveAsJpeg("MyBarCode.jpg");
MyBarCode.SaveAsPdf("MyBarCode.Pdf");
MyBarCode.SaveAsPng("MyBarCode.png");
MyBarCode.SaveAsTiff("MyBarCode.tiff");
MyBarCode.SaveAsWindowsBitmap("MyBarCode.bmp");

// Convert barcode to different image formats and obtain binary data
System.Drawing.Image MyBarCodeImage = MyBarCode.Image;
System.Drawing.Bitmap MyBarCodeBitmap = MyBarCode.ToBitmap();
string DataURL = MyBarCode.ToDataUrl();
string ImgTagForHTML = MyBarCode.ToHtmlTag();
byte[] PngBytes = MyBarCode.ToPngBinaryData();

// Save barcode in PDF stream
using (System.IO.Stream PdfStream = MyBarCode.ToPdfStream())
{
    // The Stream barcode image output also works for GIF, JPEG, PDF, PNG, BMP and TIFF
}

// Stamp barcode onto an existing PDF at a specific position
MyBarCode.StampToExistingPdfPage("ExistingPDF.pdf", 1, 200, 50);
Imports IronBarCode
' Create a barcode and save it in various formats
Private MyBarCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeEncoding.Code128)
MyBarCode.SaveAsImage("MyBarCode.png")
MyBarCode.SaveAsGif("MyBarCode.gif")
MyBarCode.SaveAsHtmlFile("MyBarCode.html")
MyBarCode.SaveAsJpeg("MyBarCode.jpg")
MyBarCode.SaveAsPdf("MyBarCode.Pdf")
MyBarCode.SaveAsPng("MyBarCode.png")
MyBarCode.SaveAsTiff("MyBarCode.tiff")
MyBarCode.SaveAsWindowsBitmap("MyBarCode.bmp")

' Convert barcode to different image formats and obtain binary data
Dim MyBarCodeImage As System.Drawing.Image = MyBarCode.Image
Dim MyBarCodeBitmap As System.Drawing.Bitmap = MyBarCode.ToBitmap()
Dim DataURL As String = MyBarCode.ToDataUrl()
Dim ImgTagForHTML As String = MyBarCode.ToHtmlTag()
Dim PngBytes() As Byte = MyBarCode.ToPngBinaryData()

' Save barcode in PDF stream
Using PdfStream As System.IO.Stream = MyBarCode.ToPdfStream()
	' The Stream barcode image output also works for GIF, JPEG, PDF, PNG, BMP and TIFF
End Using

' Stamp barcode onto an existing PDF at a specific position
MyBarCode.StampToExistingPdfPage("ExistingPDF.pdf", 1, 200, 50)
$vbLabelText   $csharpLabel

Öte yandan, ZXing, Java tabanlı açık kaynaklı bir 1D/2D barkod görüntü işleme kütüphanesidir. UPC-A, UPC-E, EAN-8, Code 93, Code 128, QR Kodu, Data Matrix, Aztec, PDF 417 ve diğer barkod formatları desteklenir.

A Comparison between IronBarcode and Zxing.NET, Figure 4: Desteklenen Barkod Formatları

Desteklenen Barkod Formatları

IronBarcode Kullanarak QR Kod Dosyaları Oluşturma

IronBarcode ile QR kodları oluşturmak için, BarcodeWriter sınıfı yerine QRCodeWriter sınıfını kullanabiliriz. Bu sınıf, QR kodları oluşturmak için bazı yeni ve ilginç özellikler sunar. Bize QR hata düzeltme seviyesini ayarlama imkanı sağlar, böylece QR kodunuzun boyutu ve okunabilirliği arasında bir denge kurabilirsiniz.

using IronBarCode;
// Generate a simple QR Code image and save as PNG
QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium).SaveAsPng("MyQR.png");
using IronBarCode;
// Generate a simple QR Code image and save as PNG
QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium).SaveAsPng("MyQR.png");
Imports IronBarCode
' Generate a simple QR Code image and save as PNG
QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium).SaveAsPng("MyQR.png")
$vbLabelText   $csharpLabel

Hata düzeltme, gerçek dünyadaki durumlarda bir QR kodunun ne kadar kolay okunabileceğini belirlememizi sağlar. Daha yüksek hata düzeltme seviyeleri, daha büyük pikseller ve karmaşıklıkla daha büyük QR kodları üretir. Aşağıdaki görüntüde, QR kod dosyasının görüntülendiğini görüyoruz.

A Comparison between IronBarcode and ZXing.NET, Figure 5: Desteklenen Barkod Formatları

QR Kod Görüntüsü

Öncelikle, IronBarCode.BarcodeWriterEncoding enum'undan barkodun değerini ve barkod formatını belirliyoruz. Daha sonra bir resim, System.Drawing.Image veya bir Bitmap kod nesnesi olarak kaydedebiliriz.

using IronBarCode;
using System.Diagnostics;

// Generate a simple BarCode image and save as PNG using the following namespaces
GeneratedBarcode MyBarCode = IronBarCode.BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeWriterEncoding.Code128);
MyBarCode.SaveAsPng("MyBarCode.png");

// This line opens the image in your default image viewer
Process.Start("MyBarCode.png");
using IronBarCode;
using System.Diagnostics;

// Generate a simple BarCode image and save as PNG using the following namespaces
GeneratedBarcode MyBarCode = IronBarCode.BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeWriterEncoding.Code128);
MyBarCode.SaveAsPng("MyBarCode.png");

// This line opens the image in your default image viewer
Process.Start("MyBarCode.png");
Imports IronBarCode
Imports System.Diagnostics

' Generate a simple BarCode image and save as PNG using the following namespaces
Dim MyBarCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeWriterEncoding.Code128)
MyBarCode.SaveAsPng("MyBarCode.png")

' This line opens the image in your default image viewer
Process.Start("MyBarCode.png")
$vbLabelText   $csharpLabel
A Comparison between IronBarcode and ZXing.NET, Figure 6: C# Örneğinde Barkod Görüntüsü Oluşturma

C# Örneğinde Barkod Görüntüsü Oluşturma

IronBarcode ayrıca, bir logo grafiği ekleyerek ve görüntünün tam ortasına bir ızgaraya yerleştirerek QR kodlarını stilize etmeyi destekler. Ayrıca belirli bir marka veya grafik kimliğine uyacak şekilde renklendirilebilir.

Test için, aşağıdaki kod örneğinde bir logo oluşturun ve QRCodeWriter.CreateQRCodeWithLogo yöntemini kullanmanın ne kadar basit olduğunu görün.

using IronBarCode;

// Adding a Logo
var MyQRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", "visual-studio-logo.png", 500);
MyQRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);
using IronBarCode;

// Adding a Logo
var MyQRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", "visual-studio-logo.png", 500);
MyQRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);
Imports IronBarCode

' Adding a Logo
Private MyQRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", "visual-studio-logo.png", 500)
MyQRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen)
$vbLabelText   $csharpLabel
A Comparison between IronBarcode and ZXing.NET, Figure 7: Logo Görüntüsü ile QR Kod Oluşturma

Logo Görüntüsü ile QR Kod Oluşturma

Son olarak, oluşturulan QR kodunu PDF dosyası olarak kaydederiz. Rahatlığınız için, son kod satırı QR kodunu HTML dosyası olarak kaydeder.

using IronBarCode;

// Adding a Logo
var MyQRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", "visual-studio-logo.png", 500);
MyQRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);

// Save as PDF
MyQRWithLogo.SaveAsPdf("MyQRWithLogo.pdf");

// Also Save as HTML
MyQRWithLogo.SaveAsHtmlFile("MyQRWithLogo.html");
using IronBarCode;

// Adding a Logo
var MyQRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", "visual-studio-logo.png", 500);
MyQRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);

// Save as PDF
MyQRWithLogo.SaveAsPdf("MyQRWithLogo.pdf");

// Also Save as HTML
MyQRWithLogo.SaveAsHtmlFile("MyQRWithLogo.html");
Imports IronBarCode

' Adding a Logo
Private MyQRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/csharp/barcode/", "visual-studio-logo.png", 500)
MyQRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen)

' Save as PDF
MyQRWithLogo.SaveAsPdf("MyQRWithLogo.pdf")

' Also Save as HTML
MyQRWithLogo.SaveAsHtmlFile("MyQRWithLogo.html")
$vbLabelText   $csharpLabel

Aşağıda, yalnızca bir kod satırı ile nasıl barkod oluşturulacağını, stil verileceğini ve dışa aktarılacağını görüyoruz.

IronBarcode, System.Linq ile benzer bir akıcı API içerir. Bir barkod oluşturur, kenar boşluklarını ayarlar ve yöntemi çağırarak bir bitmap'e dışa aktarırız. Bu çok kullanışlı olabilir ve kodun okunmasını daha kolay hale getirir.

using IronBarCode;
using System.Drawing;

// Fluent API for Barcode image generation
string MyValue = "https://ironsoftware.com/csharp/barcode";
Bitmap BarcodeBmp = IronBarCode.BarcodeWriter.CreateBarcode(MyValue, BarcodeEncoding.PDF417)
    .ResizeTo(300, 200)
    .SetMargins(100)
    .ToBitmap();
using IronBarCode;
using System.Drawing;

// Fluent API for Barcode image generation
string MyValue = "https://ironsoftware.com/csharp/barcode";
Bitmap BarcodeBmp = IronBarCode.BarcodeWriter.CreateBarcode(MyValue, BarcodeEncoding.PDF417)
    .ResizeTo(300, 200)
    .SetMargins(100)
    .ToBitmap();
Imports IronBarCode
Imports System.Drawing

' Fluent API for Barcode image generation
Dim MyValue As String = "https://ironsoftware.com/csharp/barcode"
Dim BarcodeBmp As Bitmap = IronBarCode.BarcodeWriter.CreateBarcode(MyValue, BarcodeEncoding.PDF417) _
    .ResizeTo(300, 200) _
    .SetMargins(100) _
    .ToBitmap()
$vbLabelText   $csharpLabel

Sonuç olarak, bir PDF417 barkodunun System.Drawing.Image aşağıda gösterildiği gibi görünür:

A Comparison between IronBarcode and ZXing.NET, Figure 8: C# ile Basit ve Akıcı PDF417 Barkod Üretimi

C# ile Basit ve Akıcı PDF417 Barkod Üretimi

QR Kod Dosyalarını Okuma

IronBarcode ile QR Kodları Okuma

IronBarcode sınıf kütüphanesini .NET barkod okuyucu ile birlikte kullandığınızda bir barkod veya QR kodunu okumak oldukça kolaydır. İlk örneğimizde sadece bir kod satırı kullanarak bir barkodun nasıl okunacağını görebiliyoruz.

A Comparison between IronBarcode and ZXing.NET, Figure 9: C# ile Tarama İçin Code128 Barkod Görüntüsü

C# ile Tarama İçin Code128 Barkod Görüntüsü

Barkodun değerini, görüntüsünü, kodlama türünü ve (varsa) ikili veri (binary data) alabiliriz ve ardından bunu konsola çıktısını verebiliriz.

using IronBarCode;
using System;

// Read a barcode or QR code from an image
BarcodeResult Result = BarcodeReader.QuicklyReadOneBarcode("GetStarted.png");
if (Result != null && Result.Text == "https://ironsoftware.com/csharp/barcode/")
{
    Console.WriteLine("GetStarted was a success.  Read Value: " + Result.Text);
}
using IronBarCode;
using System;

// Read a barcode or QR code from an image
BarcodeResult Result = BarcodeReader.QuicklyReadOneBarcode("GetStarted.png");
if (Result != null && Result.Text == "https://ironsoftware.com/csharp/barcode/")
{
    Console.WriteLine("GetStarted was a success.  Read Value: " + Result.Text);
}
Imports IronBarCode
Imports System

' Read a barcode or QR code from an image
Private Result As BarcodeResult = BarcodeReader.QuicklyReadOneBarcode("GetStarted.png")
If Result IsNot Nothing AndAlso Result.Text = "https://ironsoftware.com/csharp/barcode/" Then
	Console.WriteLine("GetStarted was a success.  Read Value: " & Result.Text)
End If
$vbLabelText   $csharpLabel

PDF İçindeki Barkodları Okuma

Tarandıktan bir PDF belgesini okuyacak ve birkaç kod satırında tüm tek boyutlu barkodları bulacağız.

Görebileceğiniz gibi, tek bir belgeden bir barkod okuma işlemine çok benzer, ancak şimdi barkodun hangi sayfada bulunduğunu biliyoruz.

using IronBarCode;
using System;
using System.Drawing;

// Multiple barcodes may be scanned up from a single document or image. A PDF document may also be used as the input image
PagedBarcodeResult[] PDFResults = BarcodeReader.ReadBarcodesFromPdf("MultipleBarcodes.pdf");

// Work with the results
foreach (var PageResult in PDFResults)
{
    string Value = PageResult.Value;
    int PageNum = PageResult.PageNumber;
    System.Drawing.Bitmap Img = PageResult.BarcodeImage;
    BarcodeEncoding BarcodeType = PageResult.BarcodeType;
    byte[] Binary = PageResult.BinaryValue;
    Console.WriteLine(PageResult.Value + " on page " + PageNum);
}
using IronBarCode;
using System;
using System.Drawing;

// Multiple barcodes may be scanned up from a single document or image. A PDF document may also be used as the input image
PagedBarcodeResult[] PDFResults = BarcodeReader.ReadBarcodesFromPdf("MultipleBarcodes.pdf");

// Work with the results
foreach (var PageResult in PDFResults)
{
    string Value = PageResult.Value;
    int PageNum = PageResult.PageNumber;
    System.Drawing.Bitmap Img = PageResult.BarcodeImage;
    BarcodeEncoding BarcodeType = PageResult.BarcodeType;
    byte[] Binary = PageResult.BinaryValue;
    Console.WriteLine(PageResult.Value + " on page " + PageNum);
}
Imports IronBarCode
Imports System
Imports System.Drawing

' Multiple barcodes may be scanned up from a single document or image. A PDF document may also be used as the input image
Private PDFResults() As PagedBarcodeResult = BarcodeReader.ReadBarcodesFromPdf("MultipleBarcodes.pdf")

' Work with the results
For Each PageResult In PDFResults
	Dim Value As String = PageResult.Value
	Dim PageNum As Integer = PageResult.PageNumber
	Dim Img As System.Drawing.Bitmap = PageResult.BarcodeImage
	Dim BarcodeType As BarcodeEncoding = PageResult.BarcodeType
	Dim Binary() As Byte = PageResult.BinaryValue
	Console.WriteLine(PageResult.Value & " on page " & PageNum)
Next PageResult
$vbLabelText   $csharpLabel

PDF içindeki tüm bitmap barkodları ile sonuç verileri alacaksınız.

A Comparison between IronBarcode and ZXing.NET, Figure 10: PDF Sonuçlarında Depolanan Barkodları Okuma

PDF Sonuçlarında Depolanan Barkodları Okuma

GIF ve TIFF'den Barkodları Okuma

using IronBarCode;
using System;

// Multi-frame TIFF and GIF images can also be scanned, and multiple threads will be used automatically in the background for improved performance
PagedBarcodeResult[] MultiFrameResults = BarcodeReader.ReadBarcodesFromMultiFrameTiff("Multiframe.tiff", BarcodeEncoding.Code128, BarcodeReader.BarcodeRotationCorrection.High, BarcodeReader.BarcodeImageCorrection.MediumCleanPixels);
foreach (var PageResult in MultiFrameResults)
{
    // Process each page result
}
using IronBarCode;
using System;

// Multi-frame TIFF and GIF images can also be scanned, and multiple threads will be used automatically in the background for improved performance
PagedBarcodeResult[] MultiFrameResults = BarcodeReader.ReadBarcodesFromMultiFrameTiff("Multiframe.tiff", BarcodeEncoding.Code128, BarcodeReader.BarcodeRotationCorrection.High, BarcodeReader.BarcodeImageCorrection.MediumCleanPixels);
foreach (var PageResult in MultiFrameResults)
{
    // Process each page result
}
Imports IronBarCode
Imports System

' Multi-frame TIFF and GIF images can also be scanned, and multiple threads will be used automatically in the background for improved performance
Private MultiFrameResults() As PagedBarcodeResult = BarcodeReader.ReadBarcodesFromMultiFrameTiff("Multiframe.tiff", BarcodeEncoding.Code128, BarcodeReader.BarcodeRotationCorrection.High, BarcodeReader.BarcodeImageCorrection.MediumCleanPixels)
For Each PageResult In MultiFrameResults
	' Process each page result
Next PageResult
$vbLabelText   $csharpLabel
A Comparison between IronBarcode and ZXing.NET, Figure 11: [24] Çok çerçeveli TIFF resimden barkod okuma

[24] Çok çerçeveli TIFF resimden barkod okuma

Aşağıdaki örnek, bir taranmış PDF'den QR kodlarını ve PDF-417 barkodlarını nasıl okuyacağınızı göstermektedir. Belgenin önemli bir performans cezası olmadan hafifçe temizlenmesi için uygun bir barkod döndürme düzeltme seviyesi ve barkod görüntü düzeltmesi ayarladık.

using IronBarCode;
using System;

// PDF documents can also be scanned, and multiple threads will be used automatically in the background for improved performance
var ScanResults = BarcodeReader.ReadBarcodesFromPdf("Scan.pdf", BarcodeEncoding.All, BarcodeReader.BarcodeRotationCorrection.Low, BarcodeReader.BarcodeImageCorrection.LightlyCleanPixels);

// Work with the results
foreach (var PageResult in ScanResults)
{
    string Value = PageResult.Value;
    //...
}
using IronBarCode;
using System;

// PDF documents can also be scanned, and multiple threads will be used automatically in the background for improved performance
var ScanResults = BarcodeReader.ReadBarcodesFromPdf("Scan.pdf", BarcodeEncoding.All, BarcodeReader.BarcodeRotationCorrection.Low, BarcodeReader.BarcodeImageCorrection.LightlyCleanPixels);

// Work with the results
foreach (var PageResult in ScanResults)
{
    string Value = PageResult.Value;
    //...
}
Imports IronBarCode
Imports System

' PDF documents can also be scanned, and multiple threads will be used automatically in the background for improved performance
Private ScanResults = BarcodeReader.ReadBarcodesFromPdf("Scan.pdf", BarcodeEncoding.All, BarcodeReader.BarcodeRotationCorrection.Low, BarcodeReader.BarcodeImageCorrection.LightlyCleanPixels)

' Work with the results
For Each PageResult In ScanResults
	Dim Value As String = PageResult.Value
	'...
Next PageResult
$vbLabelText   $csharpLabel
A Comparison between IronBarcode and ZXing.NET, Figure 12: Bir Taranmış PDF Belgesinden Barkod Okuma

Bir Taranmış PDF Belgesinden Barkod Okuma

Bitmap Görüntülerden BOZULAN QR Kodlarını Okuma

Aşağıdaki örnek, bu C# barkod kütüphanesinin bozuk bir barkod küçük resmini bile okuyabileceğini göstermektedir.

Barkod küçük resim boyutu otomatik olarak düzeltilir. C#'ta IronBarcode dosyayı okunabilir hale getirir.

Okuyucu yöntemleri, gerçek bir barkod olamayacak kadar küçük olan barkod görüntülerini otomatik olarak algılar ve bunları yükseltir. Küçük resimlerle çalışırken ilgili tüm dijital gürültüyü temizler, onları tekrar okunabilir hale getirir.

using IronBarCode;

// Small or 'Thumbnail' barcode images are automatically detected by IronBarcode and corrected wherever possible even if they have much digital noise.
BarcodeResult SmallResult = BarcodeReader.QuicklyReadOneBarcode("ThumbnailOfBarcode.gif", BarcodeEncoding.Code128);
using IronBarCode;

// Small or 'Thumbnail' barcode images are automatically detected by IronBarcode and corrected wherever possible even if they have much digital noise.
BarcodeResult SmallResult = BarcodeReader.QuicklyReadOneBarcode("ThumbnailOfBarcode.gif", BarcodeEncoding.Code128);
Imports IronBarCode

' Small or 'Thumbnail' barcode images are automatically detected by IronBarcode and corrected wherever possible even if they have much digital noise.
Private SmallResult As BarcodeResult = BarcodeReader.QuicklyReadOneBarcode("ThumbnailOfBarcode.gif", BarcodeEncoding.Code128)
$vbLabelText   $csharpLabel
A Comparison between IronBarcode and ZXing.NET, Figure 13: Otomatik Barkod Küçük Resim Boyutu Düzeltmesi

Otomatik Barkod Küçük Resim Boyutu Düzeltmesi

Kusurlu Görüntülerden Barkodları Okuma

Gerçek dünya senaryolarında kusurlu görüntülerden barkodları okumak isteyebiliriz. Bunlar kaymış görüntüler veya dijital gürültü içeren fotoğraflar olabilir. Çoğu açık kaynaklı .NET barkod oluşturma ve okuma kütüphanesi ile bu imkansız olurdu. Öte yandan, IronBarcode, kusurlu görüntülerden barkod okumayı çok kolay hale getirir.

Şimdi ReadASingleBarcode metoduna bakalım. RotationCorrection parametresi ile, IronBarcode hatalı dijital örneklerden barkodları düzeltmeye ve okumaya çalışır.

using IronBarCode;
using System;
using System.Drawing;

// All BarcodeResult.Read methods provide the developer with control to correct image and photograph correction and straightening rotation and perspective from skewed images
// * RotationCorrection   e.g BarcodeReader.BarcodeRotationCorrection.Extreme un-rotates and removes perspective from barcode images.
// * ImageCorrection      e.g BarcodeReader.BarcodeImageCorrection.DeepCleanPixels separates barcodes from background imagery and digital noise.
// * BarcodeEncoding      e.g. BarcodeEncoding.Code128,  Setting a specific Barcode format improves speed and reduces the risk of false positive results

// Example with a photo image
var PhotoResult = BarcodeReader.ReadASingleBarcode("Photo.png", BarcodeEncoding.Code128, BarcodeReader.BarcodeRotationCorrection.Medium, BarcodeReader.BarcodeImageCorrection.DeepCleanPixels);
string Value = PhotoResult.Value;
System.Drawing.Bitmap Img = PhotoResult.BarcodeImage;
BarcodeEncoding BarcodeType = PhotoResult.BarcodeType;
byte[] Binary = PhotoResult.BinaryValue;
Console.WriteLine(PhotoResult.Value);
using IronBarCode;
using System;
using System.Drawing;

// All BarcodeResult.Read methods provide the developer with control to correct image and photograph correction and straightening rotation and perspective from skewed images
// * RotationCorrection   e.g BarcodeReader.BarcodeRotationCorrection.Extreme un-rotates and removes perspective from barcode images.
// * ImageCorrection      e.g BarcodeReader.BarcodeImageCorrection.DeepCleanPixels separates barcodes from background imagery and digital noise.
// * BarcodeEncoding      e.g. BarcodeEncoding.Code128,  Setting a specific Barcode format improves speed and reduces the risk of false positive results

// Example with a photo image
var PhotoResult = BarcodeReader.ReadASingleBarcode("Photo.png", BarcodeEncoding.Code128, BarcodeReader.BarcodeRotationCorrection.Medium, BarcodeReader.BarcodeImageCorrection.DeepCleanPixels);
string Value = PhotoResult.Value;
System.Drawing.Bitmap Img = PhotoResult.BarcodeImage;
BarcodeEncoding BarcodeType = PhotoResult.BarcodeType;
byte[] Binary = PhotoResult.BinaryValue;
Console.WriteLine(PhotoResult.Value);
Imports IronBarCode
Imports System
Imports System.Drawing

' All BarcodeResult.Read methods provide the developer with control to correct image and photograph correction and straightening rotation and perspective from skewed images
' * RotationCorrection   e.g BarcodeReader.BarcodeRotationCorrection.Extreme un-rotates and removes perspective from barcode images.
' * ImageCorrection      e.g BarcodeReader.BarcodeImageCorrection.DeepCleanPixels separates barcodes from background imagery and digital noise.
' * BarcodeEncoding      e.g. BarcodeEncoding.Code128,  Setting a specific Barcode format improves speed and reduces the risk of false positive results

' Example with a photo image
Private PhotoResult = BarcodeReader.ReadASingleBarcode("Photo.png", BarcodeEncoding.Code128, BarcodeReader.BarcodeRotationCorrection.Medium, BarcodeReader.BarcodeImageCorrection.DeepCleanPixels)
Private Value As String = PhotoResult.Value
Private Img As System.Drawing.Bitmap = PhotoResult.BarcodeImage
Private BarcodeType As BarcodeEncoding = PhotoResult.BarcodeType
Private Binary() As Byte = PhotoResult.BinaryValue
Console.WriteLine(PhotoResult.Value)
$vbLabelText   $csharpLabel
A Comparison between IronBarcode and ZXing.NET, Figure 14: Bir Telefon Kamerasından Barkod Okuma

Bir Telefon Kamerasından Barkod Okuma

IronBarcode aynı anda birden fazla barkodu okumayı da sağlayabilir. Belgelerden bir liste oluşturduğumuzda ve barkod okuyucuyu kullanarak birçok belge okuduğumuzda IronBarcode'dan daha iyi sonuçlar elde ederiz. Barkod tarama süreci için ReadBarcodesMultithreaded yöntemi, bir kerede barkod okumaktan kat kat daha hızlı olabilecek şekilde, çoklu iş parçacığı ve potansiyel olarak CPU'nuzun tüm çekirdeklerini kullanır.

using IronBarCode;

// The BarcodeResult.ReadBarcodesMultiThreaded method allows for faster barcode scanning of multiple images or PDFs. All threads are automatically managed by IronBarcode.
var ListOfDocuments = new[] { "Image1.png", "image2.JPG", "image3.pdf" };
PagedBarcodeResult[] BatchResults = BarcodeReader.ReadBarcodesMultiThreaded(ListOfDocuments);

// Work with the results
foreach (var Result in BatchResults)
{
    string Value = Result.Value;
    //...
}
using IronBarCode;

// The BarcodeResult.ReadBarcodesMultiThreaded method allows for faster barcode scanning of multiple images or PDFs. All threads are automatically managed by IronBarcode.
var ListOfDocuments = new[] { "Image1.png", "image2.JPG", "image3.pdf" };
PagedBarcodeResult[] BatchResults = BarcodeReader.ReadBarcodesMultiThreaded(ListOfDocuments);

// Work with the results
foreach (var Result in BatchResults)
{
    string Value = Result.Value;
    //...
}
Imports IronBarCode

' The BarcodeResult.ReadBarcodesMultiThreaded method allows for faster barcode scanning of multiple images or PDFs. All threads are automatically managed by IronBarcode.
Private ListOfDocuments = { "Image1.png", "image2.JPG", "image3.pdf" }
Private BatchResults() As PagedBarcodeResult = BarcodeReader.ReadBarcodesMultiThreaded(ListOfDocuments)

' Work with the results
For Each Result In BatchResults
	Dim Value As String = Result.Value
	'...
Next Result
$vbLabelText   $csharpLabel

ZXing.NET ile QR Kodlarını Okuma ve Kod Çözme

QR kod dosyalarını okumak için, aşağıda gösterildiği gibi kontrolcünüze bir ViewFile eylem metodu ekleyin.

public ActionResult ViewFile()
{
    List<KeyValuePair<string, string>> fileData = new List<KeyValuePair<string, string>>();
    KeyValuePair<string, string> data;

    string[] files = Directory.GetFiles(Server.MapPath("~/qrr"));
    foreach (string file in files)
    {
        // Create a barcode reader instance
        IBarcodeReader reader = new BarcodeReader();

        // Load a bitmap
        var barcodeBitmap = (Bitmap)Image.FromFile(Server.MapPath("~/qrr") + "/" + Path.GetFileName(file));

        // Detect and decode the barcode inside the bitmap
        var result = reader.Decode(barcodeBitmap);

        // Do something with the result
        data = new KeyValuePair<string, string>(result.ToString(), "/QR/" + Path.GetFileName(file));
        fileData.Add(data);
    }
    return View(fileData);
}
public ActionResult ViewFile()
{
    List<KeyValuePair<string, string>> fileData = new List<KeyValuePair<string, string>>();
    KeyValuePair<string, string> data;

    string[] files = Directory.GetFiles(Server.MapPath("~/qrr"));
    foreach (string file in files)
    {
        // Create a barcode reader instance
        IBarcodeReader reader = new BarcodeReader();

        // Load a bitmap
        var barcodeBitmap = (Bitmap)Image.FromFile(Server.MapPath("~/qrr") + "/" + Path.GetFileName(file));

        // Detect and decode the barcode inside the bitmap
        var result = reader.Decode(barcodeBitmap);

        // Do something with the result
        data = new KeyValuePair<string, string>(result.ToString(), "/QR/" + Path.GetFileName(file));
        fileData.Add(data);
    }
    return View(fileData);
}
Public Function ViewFile() As ActionResult
	Dim fileData As New List(Of KeyValuePair(Of String, String))()
	Dim data As KeyValuePair(Of String, String)

	Dim files() As String = Directory.GetFiles(Server.MapPath("~/qrr"))
	For Each file As String In files
		' Create a barcode reader instance
		Dim reader As IBarcodeReader = New BarcodeReader()

		' Load a bitmap
		Dim barcodeBitmap = CType(Image.FromFile(Server.MapPath("~/qrr") & "/" & Path.GetFileName(file)), Bitmap)

		' Detect and decode the barcode inside the bitmap
		Dim result = reader.Decode(barcodeBitmap)

		' Do something with the result
		data = New KeyValuePair(Of String, String)(result.ToString(), "/QR/" & Path.GetFileName(file))
		fileData.Add(data)
	Next file
	Return View(fileData)
End Function
$vbLabelText   $csharpLabel
A Comparison between IronBarcode and ZXing.NET, Figure 15: QR Kodu Okuma ve Kod Çözme

QR Kodu Okuma ve Kod Çözme

A Comparison between IronBarcode and ZXing.NET, Figure 16: Kod Çözülmüş QR Kodu

Kod Çözülmüş QR Kodu

Bir Bitmap İçinde Barkod Kod Çözme

using ZXing;
using System.Drawing;

// Create a barcode reader instance
BarcodeReader reader = new BarcodeReader();

// Load a bitmap
var barcodeBitmap = (Bitmap)Image.FromFile("C:\\sample-barcode-image.png");

// Detect and decode the barcode inside the bitmap
var result = reader.Decode(barcodeBitmap);

// Do something with the result
if (result != null)
{
    txtDecoderType.Text = result.BarcodeFormat.ToString();
    txtDecoderContent.Text = result.Text;
}
using ZXing;
using System.Drawing;

// Create a barcode reader instance
BarcodeReader reader = new BarcodeReader();

// Load a bitmap
var barcodeBitmap = (Bitmap)Image.FromFile("C:\\sample-barcode-image.png");

// Detect and decode the barcode inside the bitmap
var result = reader.Decode(barcodeBitmap);

// Do something with the result
if (result != null)
{
    txtDecoderType.Text = result.BarcodeFormat.ToString();
    txtDecoderContent.Text = result.Text;
}
Imports ZXing
Imports System.Drawing

' Create a barcode reader instance
Private reader As New BarcodeReader()

' Load a bitmap
Private barcodeBitmap = CType(Image.FromFile("C:\sample-barcode-image.png"), Bitmap)

' Detect and decode the barcode inside the bitmap
Private result = reader.Decode(barcodeBitmap)

' Do something with the result
If result IsNot Nothing Then
	txtDecoderType.Text = result.BarcodeFormat.ToString()
	txtDecoderContent.Text = result.Text
End If
$vbLabelText   $csharpLabel

ZXing Çözücü Çevrimiçi

ZXing Çözücü Çevrimiçi, çevrimiçi olarak mevcut olan ve kod çözme desteği sağlayan bir barkod ve QR kod tarayıcısıdır. PNG veya başka bir QR kodu görüntü formatını yükleyin, ardından kod çözme işlemine başlayacaktır. Benzer şekilde, herhangi bir veri için bir QR kod oluşturabilirsiniz. Çoğu zaman, bu bilgiler QR kodunda kodlamak istediğiniz bir URL veya metin olacaktır.

ZXing Çözücü web sitesine gidin.

A Comparison between IronBarcode and ZXing.NET, Figure 17: Kod Çözülmüş QR Kodu

ZXing Çözücü Web Sitesi

A Comparison between IronBarcode and ZXing.NET, Figure 18: Kod Çözülmüş QR Kodu

ZXing Çözme Sonucu

Fiyatlandırma ve Lisanslama

ZXing.NET kütüphanesi, Apache Lisansı 2.0 altında lisanslanmış ücretsiz ve açık kaynaklı bir kütüphanedir; doğru atıfla ticari kullanıma izin verir ve barkod okuma uygulamaları oluşturmanıza olanak tanır.

IronBarcode için geliştirici lisansı ücretsiz olarak sunulmaktadır. IronBarcode'un benzersiz bir fiyatlandırma düzeni var: Lite paketi, $liteLicense ile başlar ve ek masrafı yoktur. SaaS ve OEM ürünleri de tekrar dağıtılabilir. Her lisans, süresiz lisans, geliştirme/sahne/uretim gecerliligi, 30 günlük para iade garantisi ve bir yillik yazilim destegi ve güncellemeleri icerir (tek seferlik satin alma). Bu sayfayi ziyaret ederek IronBarcode'nin tam fiyatlandirma ve lisans bilgilerini görüntüleyebilirsiniz.

Neden IronBarcode'i Secmelisiniz?

IronBarcode, .NET'te barkodlari okuyup yazmak icin geliştiricilere kolay kullanimli bir API sunar ve gerçek dunya kullanim senaryolarinda dogrulugu optimize eder ve hata oranini dusurur.

Örneğin, BarcodeWriter sınıfı, UPCA ve UPCE barkodları üzerinde 'kontrol toplamlarını' doğrular ve düzeltir. Ayrica, belirli bir sayisal formata girilecek kadar kisa olan sayilari 'sifir ile tamamlayacaktir'. Eger veriniz belirtilen veri formatiyla uyumlu degilse, IronBarcode geliştiriciyi kullanmasi icin daha uygun bir barkod formati konusunda bilgilendirir.

IronBarcode, barkod tarandiginda veya bir fotografik görüntüden okundugunda; yani görüntünun grafiksel olarak mükemmel olmadigi ve makine tarafindan uretilen bir ekran görüntüsu olmadigi durumlarda barkod okuma konusunda mukemmeldir.

IronBarcode, ZXing.NET'ten Nasıl Farklidir?

IronBarcode, iyilestirilmis işleme yetenegine sahip ZXing.NET (Zebra Crossing) cekirdeginden insa edilmistir. Kullanıcı kolayligi saglayan bir API ve ZXing.NET cekirdek kutuphanesine kiyasla dusuk hata oranina sahiptir. Bununla kalmayip, IronBarcode, genellikle ZXing.NET kutuphanesinin destekledigi formattan daha genis bir barkod format araligini destekler.

IronBarcode, ZXing.NET'in daha gelişmiş bir versiyonudur ve kullaniciya ticari kullanim platrformunu ve ayni paketinin birden fazla platformda kullanilma imkanini sunar. Ayrica, size yardimci olmaya her zaman hazır, tam teknik destegi bulunur.

IronBarcode, otomatik donme, perspektif düzeltmesi ve dijital gurultu düzeltmesi icerir ve bir görüntüye kodlanmis barkod tipini tespit edebilir.

Sonuç

Sonuc olarak, IronBarcode, ekran görüntüleri, fotograflar, taramalar veya diğer kusurlu gerçek dunya görüntüleri olup olmamasina bakilmaksizin genis bir barkod format araligini okumak icin çok yonlu bir .NET yazilim kutuphanesi ve C# QR Kodu ureticisidir.

IronBarcode, barkod oluşturma ve tanima icin en etkili kutuphanelerden biridir. Barkod oluşturma ve tanima konusunda ayni zamanda en hizli kutuphanelerden biridir. Kütüphane, farklı işletim sistemleriyla uyumludur. Tasarimi kolaydir ve genis bir barkod formatlari yelpazesi destekler. Ayrica, çeşitli semboller, formatlar ve karakterler de desteklenir.

ZXing.NET barkod, çeşitli görüntü formatlarinda barkod uretip tanirabilen guclu bir kutuphanedir. Çeşitli formatlardaki görüntüleri okuyabilir ve oluşturabiliriz. ZXing.NET, barkodun gorunumunu değiştirmenizi, yukseklik, genislik, barkod metnini değiştirmenizi ve benzeri seyleri de yapmanizi saglar.

ZXing.NET'e kiyasla, IronBarcode paketleri guvenilir lisanslama ve destek sunar. IronBarcode $liteLicense'a mal olur. ZXing ücretsiz ve acik kaynak olsa da, IronBarcode kapsamli ticari destek ve profesyonel bakim sunar. ZXing.NET'e gore daha esnek olmasinin yaninda, IronBarcode cozumunun de daha fazla islevselligi vardir. Dolayisiyla, IronBarcode'un ZXing.NET uzerinde guclu bir avantaj sundugu aciktir.

Barkod taniyaminda ve uretilmesinde işleme surelerini karsilastirdigimizda, IronBarcode, ZXing.NET'i geride birakir. IronBarcode, farkli görüntü formatlarindan ve PDF belgelerinden barkod okutmaya olanak taniyan bircok ozellige sahiptir. Ayrica, baska hicbir kutuphanede bulunmayan, barkod veya QR kod icine görüntü eklememize olanak taniyor.

Kalkinmanin ilk asamalari icin IronBarcode ucretsizdir. Uretim seviyesi veya ticari kullanim icin ücretsiz deneme alabilirsiniz. Geliştiricinin gereksinimlerine gore, IronBarcode uc fiyatlandiirma duzeyi sunar. Taleplerinizi en iyi karsilayan cozumu secilebilir. Simdi bes Iron Software urununu iki Iron Software urunu fiyatina alabilirsiniz. Bu web sitesini daha fazla bilgi icin ziyaret edin.

(

Lütfen dikkate alinZXing.NET, ilgili sahibinin tescilli bir markasidir. Bu site ZXing.NET ile baglantili, onayli veya destekli degildir. Tüm ürün adları, logolar ve markalar kendi sahiplerinin mülkiyetindedir. Karşılaştırmalar yalnızca bilgilendirme amaçlıdır ve yazım sırasında kamuya açık bilgileri yansıtır.

Sıkça Sorulan Sorular

C#'da QR kodu nasıl oluşturabilirim?

IronBarcode kullanarak `BarcodeWriter` sınıfıyla C# içinde bir QR kodu üretebilirsiniz. Tek yapmanız gereken QR kodunun içeriğini tanımlamak, renk ve boyut gibi seçenekleri özelleştirmek ve QR kodunu üretmek için `Write` metodunu çağırmaktır.

IronBarcode'u ZXing.NET'ten daha sağlam yapan nedir?

IronBarcode, daha geniş bir barkod format yelpazesi için destek, döndürme ve perspektif düzeltme gibi gelişmiş görüntü işleme özellikleri ve logolar ve renkler ile dekore edilmiş QR kodları oluşturma yeteneği gibi geliştirilmiş yetenekler sunar. Ayrıca, platformlar arası uyumluluk sağlar ve ticari destek sunar.

Kusurlu görüntülerden barkod okuyabilir miyim IronBarcode kullanarak?

Evet, IronBarcode, döndürme düzeltme, perspektif düzeltme ve dijital gürültü azaltma gibi özellikler kullanarak kusurlu görüntülerden barkod okuyabilir, bu da onu taranmış veya fotoğrafik görüntüler için etkili hale getirir.

C# içinde bir barkod okumak için adımlar nelerdir?

C# içinde bir barkod okumak için, IronBarcode'un `BarcodeReader` sınıfını kullanın. Barkod içeren görüntüyü yüklemek için `BarcodeReader.QuicklyReadOneBarcode` metodunu kullanın, bu metod tanıdığı takdirde barkod içeriğini çözecek ve geri döndürecektir.

IronBarcode, platformlar arası uyumluluğu nasıl yönetiyor?

IronBarcode, Windows, macOS, Linux ve Azure için platformlar arası uyumluluk desteği sunar, böylece çeşitli .NET uygulamalarına üçüncü taraf bağımlılıklar olmaksızın barkod oluşturma ve okuma fonksiyonları entegre edilebilir.

IronBarcode ile QR kodları özelleştirmek için hangi seçenekler mevcut?

IronBarcode, QR kodlarını renk ayarlayarak, marka logoları ekleyerek ve hata düzeltme seviyelerini ayarlayarak boyut ve okunabilirlik arasında denge kurarak özelleştirme imkanı sunar, bu da çeşitli estetik ve işlevsel gereksinimler için esneklik sağlar.

Ticari uygulamalarda IronBarcode kullanmak için bir lisans ücreti var mı?

IronBarcode, ticari uygulamalar için uygun olan sürekli bir lisans da dahil olmak üzere çeşitli lisanslama seçenekleri sunar. Bu, ücretsiz ancak ticari kullanım için sınırlamaları olan ZXing.NET ile tezat oluşturur.

Barkod kütüphaneleri kullanılırken yaygın sorun çözme senaryoları nelerdir?

Yaygın sorunlar, zayıf görüntü kalitesi nedeniyle yanlış barkod tanıma, desteklenmeyen barkod formatları veya yapılandırma hataları olabilir. IronBarcode'un gelişmiş görüntü işleme özellikleri bazı tanıma sorunlarını hafifletmeye yardımcı olabilir.

Neden birisi barkod işlemleri için ZXing.NET yerine IronBarcode tercih edebilir?

IronBarcode, daha sağlam bir API, daha iyi hata yönetimi, geniş barkod format desteği ve görsel olarak özelleştirilmiş QR kodları oluşturma özellikleri ile birlikte ticari lisanslama ve profesyonel destek gibi avantajlar sağlar.

Bir .NET projesine IronBarcode nasıl yüklenir?

Visual Studio'da NuGet Paket Yöneticisi kullanarak 'IronBarcode' aratabilir ve projenize ekleyerek kolay entegrasyon ve güncellemeler sağlayabilirsiniz.

Jordi Bardia
Yazılım Mühendisi
Jordi Python, C# ve C++ konularında en yetkin, Iron Software'deki yeteneklerini kullanmadığı zamanlarda; oyun programlıyor. Ürün testi, ürün geliştirme ve araştırma sorumluluklarını paylaşan Jordi, sürekli ürün gelişimine büyük değer katıyor. Çeşitli deneyimleri onu ...
Daha Fazlasını Oku

Iron Destek Ekibi

Haftanın 5 günü, 24 saat çevrimiçiyiz.
Sohbet
E-posta
Beni Ara