與其他組件的比較 IronBarcode與ZXing.NET的比較 Jordi Bardia 更新日期:7月 28, 2025 Download IronBarcode NuGet 下載 DLL 下載 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article 條碼掃描器可能並不總是適合我們的應用程式。 您可能已經有條碼的數位圖像,並希望知道它在英文文本中代表什麼。 此外,此掃描器僅能讀取 1-D 條碼,包含有限的數據量,並且只能在 Windows RT 類別庫中使用。 2-D 條碼(又稱為 QR 碼)現在很常見,可以容納更多的信息。 可以創建基於 C# 的應用程式來使用簡單的 API 呼叫和一些編碼步驟來讀取條碼。 .NET 支持的應用程式可在 Windows、macOS 或 Linux 上運行,不依賴於任何第三方工具或 API。 本文將比較兩個功能最強大的 .NET Core 應用程式庫,以便程式化地讀取條碼。 這兩個庫是 IronBarcode 和 ZXing.NET。 我們將看到什麼使 IronBarcode 比 ZXing.NET 更強大和穩健。 class="hsg-featured-snippet"> 如何使用 Zxing 在 C# 中生成條碼 安裝 C# 庫以生成條碼 從 BarcodeWriterPixelData 類創建新對象以自定義條碼 使用 Format 屬性設置條碼類型 實例化 QrCodeEncodingOptions 類進一步自定義高、寬、邊距 使用第二步中的物件的 Write 方法在 C# 中生成條碼 什麼是 ZXing.NET ZXing.NET 是一個可以解碼並生成條碼(如 QR 碼、PDF 417、EAN、UPC、Aztec、Data Matrix、Codabar)的庫。 ZXing(代表 "zebra crossing")是基於 Java 的開源庫,支持多種 1D 和 2D 條碼格式。 其基本特徵如下: 它有能力存儲 URL、聯繫人詳情、日曆事件等等。 它專為 Java SE 應用程式設計。 它允許通過意圖進行條碼掃描器整合。 它是簡單的 Google Glass 應用程式。 什麼是 IronBarcode IronBarcode 是一個 C# 庫,允許程式員讀取和生成條碼。 作為領先的條碼庫,IronBarcode 支持多種一維和二維條碼,包括裝飾(彩色和品牌)QR 碼。 它支持 .NET Standard 和 Core 版本 2 及更高版本,允許它在 Azure、Linux、macOS、Windows 和 Web 平台上跨平台使用。 IronBarcode 是 .NET 系統中著名的類庫或組件,允許 C#、VB.NET 和 F# 的開發者使用標準編程語言。 它允許客戶瀏覽掃描器標籤並創建新的標準標籤。 它與 2D 條碼和其他 3D 標準條碼配合得很好。 IronBarcode 現在支持 2D 條碼。 它提供的功能包括優化這些代碼的顏色、樣式和像素化以及添加標誌的能力,以便用於印刷或廣告資料。 該庫還可以讀取傾斜和變形的條碼,這是其他條碼軟體可能無法讀取的。 安裝 IronBarcode 和 ZXing.NET 安裝 ZXing.NET 要使用 ZXing.NET 庫,請在您的 ASP.NET Core 應用程式中使用 NuGet Package Manager Console 安裝以下兩個包: 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 或者,使用 NuGet Package Manager 在您的專案中安裝 ZXing.NET。 為此,轉到 工具 > NuGet 套件管理器 > 管理解決方案的 NuGet 套件...,然後切換到 "瀏覽" 標籤並搜索 "ZXing.NET"。 class="content-img-align-center"> class="content__image-caption">ASP.NET Web 應用程式 安裝 IronBarcode 使用 NuGet Package Manager 或直接從產品網站下載 DLL 安裝 IronBarcode。 IronBarcode 命名空間包含所有 IronBarcode 類別。 IronBarcode 可以使用 Visual Studio 的 NuGet Package Manager 安裝:包名為 "Barcode"。 Install-Package BarCode 創建 2D 條碼 使用 ZXing.NET 首先,在專案文件的根目錄中創建一個名為 'qrr' 的新文件夾。 然後我們將繼續創建 QR 文件並將圖像系統文件存儲在 'qrr' 文件夾中。 在控制器中,添加 GenerateFile() 方法,如下所述的源代碼所示。 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 唯一剩下的更改就是將 QR 碼文件保存到 'qrr' 文件夾中。 這是通過下面的兩行代碼完成的。 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 接下來,您必須創建 GenerateFile 視圖並在其中包含以下代碼。 GenerateFile 視圖與 Index 視圖相同。 @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 在文本框中輸入任意值並單擊 "提交" 按鈕。 QR 碼將被生成並保存為 .PNG 文件在 'qrr' 文件夾中。 class="content-img-align-center"> class="content__image-caption">QR Code Generator class="content-img-align-center"> class="content__image-caption">QR Code Files Displayed 支持的條碼格式 IronBarcode 支持多種常用的條碼格式,包括: 具有標誌和顏色的 QR 碼(包括裝飾和品牌代碼) 多格式條碼包括 Aztec、Data Matrix、CODE 93、CODE 128、RSS Expanded Databar、UPS MaxiCode 和 USPS、IMB (OneCode) 條碼 RSS-14 和 PDF-417 堆疊線性條碼 UPCA、UPCE、EAN-8、EAN-13、Codabar、ITF、MSI 和 Plessey 是傳統的數字條碼格式。 創建和保存條碼 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 另一方面,ZXing 是一個基於 Java 的開源 1D/2D 條碼圖像處理庫。 UPC-A、UPC-E、EAN-8、Code 93、Code 128、QR 碼、Data Matrix、Aztec、PDF 417 和其他條碼格式均受支持。 class="content-img-align-center"> class="content__image-caption">Supported Barcode Formats 使用 IronBarcode 創建 QR Code 文件 要使用 IronBarcode 創建 QR 碼,我們可以使用 QRCodeWriter 類而非 BarcodeWriter 類。 此類引入了一些新穎和有趣的功能來創建 QR 碼。 它使我們能夠設置 QR 碼的錯誤校正級別,使您能夠在 QR 碼的尺寸和可讀性之間取得平衡。 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 錯誤校正使我們能夠指定在現實環境中讀取 QR 碼的難易程度。 更高的錯誤校正級別導致更大的 QR 碼,具有更多的像素和更高的復雜性。 在下面的圖像中,我們看到顯示的 QR 碼文件。 class="content-img-align-center"> class="content__image-caption">QR Code Image 我們開始指定條碼的值和條碼格式,這些來自 IronBarcode.BarcodeWriterEncoding 枚舉。 然後,我們可以保存為圖像、一個 System.Drawing.Image 或位圖代碼對象。 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 Private MyBarCode As GeneratedBarcode = 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") $vbLabelText $csharpLabel class="content-img-align-center"> class="content__image-caption">Create a Barcode Image in C# Example IronBarcode 也支持對 QR 碼進行風格化處理,例如在圖像的正中心放置並貼合的標誌圖形。 它還可以被染色以符合特定品牌或圖形身份。 在下面的代碼示例中創建一個標誌並查看使用 QRCodeWriter.CreateQRCodeWithLogo 方法的簡單步驟。 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 class="content-img-align-center"> class="content__image-caption">Create QR Code With Logo Image 最後,我們將生成的 QR 碼保存為 PDF 文件。為了您的方便,最後一行代碼將 QR 碼保存為 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"); 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 如下所示,我們可以只用一行代碼創建、設計和導出條碼。 IronBarcode 包含一個流逝 API,類似 System.Linq。 我們創建一個條碼,設置其邊距,然後在一行中通過方法鏈式調用將其導出為位圖。 這可以非常有用,使代碼更易於閱讀。 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 Private MyValue As String = "https://ironsoftware.com/csharp/barcode" Private BarcodeBmp As Bitmap = IronBarcode.BarcodeWriter.CreateBarcode(MyValue, BarcodeEncoding.PDF417).ResizeTo(300, 200).SetMargins(100).ToBitmap() $vbLabelText $csharpLabel 在下圖中,我們看到一個 PDF417 條碼的 System.Drawing.Image: class="content-img-align-center"> class="content__image-caption">Simple, fluent PDF417 Barcode Generation in C# 讀取 QR 碼文件 使用 IronBarcode 讀取 QR 碼 使用 IronBarcode 類庫結合 .NET 條碼閱讀器讀取條碼或 QR 碼很簡單。 在我們的第一個示例中,我們可以看到如何僅用一行代碼來讀取條碼。 class="content-img-align-center"> class="content__image-caption">Code128 Barcode Image to be Scanned with C# 我們可以獲取條碼的值、圖像、編碼類型和二進位數據(如有)然後將其輸出到控制台。 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 中的條碼 我們將研究如何讀取掃描的 PDF 文件並僅用幾行代碼找到所有的一維條碼。 如您所見,它與從單個文件中讀取單個條碼非常相似,只是我們現在知道條碼在哪個頁面上被發現。 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 中所有位圖條碼的結果數據。 class="content-img-align-center"> class="content__image-caption">Reading Barcodes Stored Inside PDF Results 從 GIF 和 TIFF 中讀取條碼 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 class="content-img-align-center"> class="content__image-caption">Reading Barcodes from a Multi-frame TIFF Image 以下示例顯示了如何從掃描的 PDF 文件中讀取 QR 碼和 PDF-417 條碼。 我們已設定適當的條碼旋轉校正和條碼圖像校正在不會導致性能懲罰的情況下輕度清理文檔。 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 class="content-img-align-center"> class="content__image-caption">Reading Barcodes from a Scanned PDF Document 從位圖圖像中讀取損壞的 QR 碼 下面的示例顯示該 C# 條碼庫甚至可以讀取損壞的條碼縮略圖。 條碼縮略圖尺寸的校正是自動完成的。 C# 中的 IronBarcode 使文件可以讀取。 讀取方法會自動檢測尺寸過小而無法成為合法條碼的圖像並進行放大。 它們會清除所有與處理縮略圖相關的數位雜訊,使它們再次可讀。 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 class="content-img-align-center"> class="content__image-caption">Automatic Barcode Thumbnail Size Correction 從不完美的圖像中讀取條碼 在現實場景中,我們可能希望從不完美的圖像中讀取條碼。 它們可能是傾斜的圖像或數位雜訊的照片。對於大多數開源 .NET 條碼生成和讀取庫來說,這會很困難。 而 IronBarcode 使從不完美的圖像中讀取條碼變得非常簡單。 我們現在將介紹 ReadASingleBarcode 方法。 使用其 RotationCorrection 參數,IronBarcode 嘗試從不完美的數字樣本中去偏和讀取條碼。 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 class="content-img-align-center"> class="content__image-caption">Reading a Barcode From a Phone Camera IronBarcode 還可以同時讀取多個條碼。當我們創建一個文檔列表並使用條碼掃描器閱讀多個文檔時,IronBarcode 提供更好的結果。 條碼掃描過程的 ReadBarcodesMultithreaded 方法使用多個執行緒並可能使用您 CPU 的所有核心,這可以比一次讀取一個條碼快得多。 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 讀取和解碼 QR 碼 要讀取 QR 碼文件,請按如下所示將 ViewFile 動作方法添加到您的控制器中。 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 class="content-img-align-center"> class="content__image-caption">Reading and Decoding QR Code class="content-img-align-center"> class="content__image-caption">Decoded QR Code 解碼位圖內的條碼 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 解碼器在線 ZXing 解碼器在線是一個可以解碼的條碼和 QR 碼掃描器。 上傳一個 PNG 或其他格式的 QR 碼圖像,然後它將開始解碼。 類似地,您可以為任何數據生成 QR 碼。 通常那信息將是一個您想在 QR 碼中進行編碼的 URL 或文本。 導航到 ZXing 解碼器網站。 class="content_img_align_center"> class="content__image_caption">ZXing Decoder Website class="content_img_align_center"> class="content__image_caption">ZXing Decode Result Pricing and Licensing ZXing.NET 庫是免費的開源庫,它允許您構建條碼閱讀應用程式,受 Apache 許可證 2.0 授權,允許在正確歸屬的情況下免費商業使用。 IronBarcode 提供不收費的開發者許可。 IronBarcode 擁有獨特的定價方案:Lite 套餐起價 $liteLicense,無需額外費用。 SaaS 和 OEM 項目也可以重新發行。 每個許可證包括永久許可、生產環境的效力、30 天退款保證和一年的軟體支持和升級(一次性購買)。 訪問此頁面查看 IronBarcode 的完整定價和許可信息。 為什麼選擇 IronBarcode? IronBarcode 包含易於使用的 API,讓開發者可以在 .NET 中讀寫條碼,並優化真實情況下的準確性和低錯誤率。 BarcodeWriter 類,例如,會校驗並修正 UPCA 和 UPCE 條碼上的檢錯碼。 它還會對數字過短而無法進入特定數字格式的數字進行零填充。 如果您的數據不兼容指定的數據格式,IronBarcode 會通知開發人員他們可能使用的更合適的條碼格式。 當條碼被掃描或從圖像讀取並不完美時,IronBarcode 擅長於閱讀條碼。 IronBarcode 與 ZXing.NET 有什麼不同? IronBarcode 是從 ZXing.NET(Zebra Crossing)核心構建的,具有更高的處理能力。 它配有一個易於使用的 API,與 ZXing.NET 核心庫相比具有較低的錯誤率。 不僅如此,IronBarcode 還支持更廣泛的條碼格式。 IronBarcode 是一個更改進的版本,提供商業使用的平台和在多個平台上使用相同包的可能性。 它還有完整的技術支援,隨時準備在您需要時提供幫助。 IronBarcode 具備自動旋轉、透視校正和數位雜訊校正功能,並可檢測圖像中編碼的條碼類型。 結論 總之,IronBarcode 是一個多功能的 .NET 軟體庫和 C# QR 碼生成器,無論是截圖、照片、掃描還是其他不完美的現實情況下的圖像,都可以讀取多種條碼格式。 IronBarcode 是創建和識別條碼最有效的庫之一。 在創建和識別條碼方面,它也是最快的庫之一。 该库兼容不同的操作系统。 設計簡單,支持的條碼格式種類多樣。 此外,還支持各種符號、格式和字符。 ZXing.NET 條碼是一個強大的庫,能夠生成和識別多種圖像格式的條碼。 我們可以讀取和創建不同格式的圖像。 ZXing.NET 還允許您更改條碼外觀,調整其高度、寬度、條碼文本等。 與 ZXing.NET 相比,IronBarcode 套件提供可靠的許可和支援。 IronBarcode 售價 $liteLicense。 雖然 ZXing 是免費且開源的,但 IronBarcode 提供全面的商業支持和專業的維護。 除了比 ZXing.NET 更靈活,Iron Barcode 解決方案還具有更多功能。 因此,很明顯,IronBarcode 在 ZXing.NET 上具有強大的優勢。 在處理條碼識別和生成的時間比較中,IronBarcode 超過了 ZXing.NET。 IronBarcode 還有多個屬性,可以從不同的圖像格式和 PDF 文件中讀取條碼。 它還允許我們在條碼或 QR 碼中包含圖像,這在其他庫中特殊。 IronBarcode 是早期開發階段的免費工具。 您可以獲得一個 免費試用用于生產階段或商業用途。 根據開發者的需求,IronBarcode 提供三種定價方案。 您可以選擇最能滿足您需求的解決方案。 您現在可以以兩個 Iron Software 產品的價格獲得五個 Iron Software 產品組合。 訪問此網站以獲取更多信息。 [{i:(ZXing.NET 是其各自所有者的註冊商標。 本網站與 ZXing.NET 沒有任何附屬關係、認可關係或贊助關係。 所有產品名稱、徽標和品牌均為其各自所有者的財產。 比較僅供參考,反映撰寫時公開可用的信息。 常見問題解答 我怎样才能在 C# 中生成 QR 码? 您可以通过利用 IronBarcode 的 `BarcodeWriter` 类在 C# 中生成 QR 码。只需定义 QR 码内容,自定义选项如颜色和大小,然后调用 `Write` 方法生成 QR 码。 是什么让 IronBarcode 比 ZXing.NET 更加稳健? IronBarcode 提供增强的功能,如支持更多的条形码格式,先进的图像处理功能如旋转和透视校正,以及创建带有标识和颜色的装饰 QR 码的能力。它还具有跨平台兼容性,并提供商业支持。 我可以使用 IronBarcode 从有缺陷的图像中读取条形码吗? 可以,IronBarcode 可以使用旋转校正、透视校正和数字噪声减少等功能从有缺陷的图像中读取条形码,非常适合扫描或摄影图像。 在 C# 中读取条形码的步骤是什么? 要在 C# 中读取条形码,使用 IronBarcode 的 `BarcodeReader` 类。使用 `BarcodeReader.QuicklyReadOneBarcode` 方法加载包含条形码的图像,该方法将解码并返回条形码内容(如果识别成功)。 IronBarcode 如何处理跨平台兼容性? IronBarcode 支持 Windows、macOS、Linux 和 Azure 的跨平台兼容性,允许您将条形码生成和读取功能集成到各种 .NET 应用程序中,无需第三方依赖。 有哪些选项可用于使用 IronBarcode 自定义 QR 码? IronBarcode 允许通过调整颜色、添加品牌标识和配置纠错级别以平衡大小和可读性来自定义 QR 码,为各种美学和功能需求提供灵活性。 在商业应用中使用 IronBarcode 是否需要支付许可费用? IronBarcode 提供不同的许可选项,包括适合于商业应用的永久许可。这与 ZXing.NET 免费但对商业使用有限制形成对比。 在使用条形码库时有哪些常见的故障排除场景? 常见问题可能包括由于图像质量差导致的错误条形码识别、不支持的条形码格式或配置错误。IronBarcode 的高级图像处理功能可以帮助缓解一些识别问题。 为什么有人可能会选择 IronBarcode 而不是 ZXing.NET 进行条形码处理? IronBarcode 提供更稳健的 API,更好的错误处理,广泛的条形码格式支持以及生成个性化 QR 码的功能,还附带商业许可和专业支持的好处。 如何在 .NET 项目中安装 IronBarcode? 您可以使用 Visual Studio 中的 NuGet 包管理器在 .NET 项目中安装 IronBarcode,通过搜索 'IronBarcode' 并将其添加到您的项目中,确保轻松集成和更新。 Jordi Bardia 立即與工程團隊聊天 軟體工程師 Jordi 在 Python、C# 和 C++ 上最得心應手,當他不在 Iron Software 展現技術時,便在做遊戲編程。在分担产品测测试,产品开发和研究的责任时,Jordi 为持续的产品改进增值。他说这种多样化的经验使他受到挑战并保持参与, 而这也是他与 Iron Software 中工作一大乐趣。Jordi 在佛罗里达州迈阿密长大,曾在佛罗里达大学学习计算机科学和统计学。 相關文章 更新日期 9月 25, 2025 如何在C#中選擇最佳條碼庫 在本指南中,我們將比較五個最廣泛使用的 .NET 條碼庫 — IronBarcode, http://ZXing.Net , Aspose.BarCode, BarcodeLib, 和 Dynamsoft Barcode Reader 閱讀更多 更新日期 7月 28, 2025 如何在ZXing中為C#開發人員掃描條碼 ZXing的模塊包括核心圖像解碼庫、JavaSE特定的客戶端代碼以及Android客戶端條碼掃描器。許多其他獨立的開源項目以此為基礎構建。 閱讀更多 更新日期 8月 31, 2025 ZXing.org QR碼庫和IronBarcode:全面的比較 ZXing是一個流行的開源庫,用於生成和解碼一維和二維條碼。 閱讀更多 ZXing解碼器與IronBarcode的比較IronBarcode和Aspose.Barcode之間...
更新日期 9月 25, 2025 如何在C#中選擇最佳條碼庫 在本指南中,我們將比較五個最廣泛使用的 .NET 條碼庫 — IronBarcode, http://ZXing.Net , Aspose.BarCode, BarcodeLib, 和 Dynamsoft Barcode Reader 閱讀更多
更新日期 7月 28, 2025 如何在ZXing中為C#開發人員掃描條碼 ZXing的模塊包括核心圖像解碼庫、JavaSE特定的客戶端代碼以及Android客戶端條碼掃描器。許多其他獨立的開源項目以此為基礎構建。 閱讀更多