C# 和 VB .NET 代碼示例
using IronBarCode;
using System.Drawing;
// Reading a barcode is easy with IronBarcode!
var resultFromFile = BarcodeReader.Read(@"file/barcode.png"); // From a file
var resultFromBitMap = BarcodeReader.Read(new Bitmap("barcode.bmp")); // From a bitmap
var resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")); // From an image file
var resultFromPdf = BarcodeReader.ReadPdf(@"file/mydocument.pdf"); // From PDF use ReadPdf
// To configure and fine-tune barcode reading, utilize the BarcodeReaderOptions class
var myOptionsExample = new BarcodeReaderOptions
{
// Choose a reading speed from: Faster, Balanced, Detailed, ExtremeDetail
// There is a tradeoff in performance as more detail is set
Speed = ReadingSpeed.Balanced,
// Reader will stop scanning once a single barcode is found (if set to true)
ExpectMultipleBarcodes = true,
// By default, all barcode formats are scanned for
// Specifying a subset of barcode types to search for would improve performance
ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
// Utilize multiple threads to read barcodes from multiple images in parallel
Multithreaded = true,
// Maximum threads for parallelized barcode reading
// Default is 4
MaxParallelThreads = 2,
// The area of each image frame in which to scan for barcodes
// Specifying a crop area will significantly improve performance and avoid noisy parts of the image
CropArea = new Rectangle(),
// Special setting for Code39 barcodes
// If a Code39 barcode is detected, try to read with both the base and extended ASCII character sets
UseCode39ExtendedMode = true
};
// Read with the options applied
var results = BarcodeReader.Read("barcode.png", myOptionsExample);
// Create a barcode with one line of code
var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);
// After creating a barcode, we may choose to resize
myBarcode.ResizeTo(400, 100);
// Save our newly-created barcode as an image
myBarcode.SaveAsImage("EAN8.jpeg");
// Get the barcode as an image for further processing
var myBarcodeImage = myBarcode.Image;
using IronBarCode;
using System.Drawing;
// Reading a barcode is easy with IronBarcode!
var resultFromFile = BarcodeReader.Read(@"file/barcode.png"); // From a file
var resultFromBitMap = BarcodeReader.Read(new Bitmap("barcode.bmp")); // From a bitmap
var resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")); // From an image file
var resultFromPdf = BarcodeReader.ReadPdf(@"file/mydocument.pdf"); // From PDF use ReadPdf
// To configure and fine-tune barcode reading, utilize the BarcodeReaderOptions class
var myOptionsExample = new BarcodeReaderOptions
{
// Choose a reading speed from: Faster, Balanced, Detailed, ExtremeDetail
// There is a tradeoff in performance as more detail is set
Speed = ReadingSpeed.Balanced,
// Reader will stop scanning once a single barcode is found (if set to true)
ExpectMultipleBarcodes = true,
// By default, all barcode formats are scanned for
// Specifying a subset of barcode types to search for would improve performance
ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
// Utilize multiple threads to read barcodes from multiple images in parallel
Multithreaded = true,
// Maximum threads for parallelized barcode reading
// Default is 4
MaxParallelThreads = 2,
// The area of each image frame in which to scan for barcodes
// Specifying a crop area will significantly improve performance and avoid noisy parts of the image
CropArea = new Rectangle(),
// Special setting for Code39 barcodes
// If a Code39 barcode is detected, try to read with both the base and extended ASCII character sets
UseCode39ExtendedMode = true
};
// Read with the options applied
var results = BarcodeReader.Read("barcode.png", myOptionsExample);
// Create a barcode with one line of code
var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);
// After creating a barcode, we may choose to resize
myBarcode.ResizeTo(400, 100);
// Save our newly-created barcode as an image
myBarcode.SaveAsImage("EAN8.jpeg");
// Get the barcode as an image for further processing
var myBarcodeImage = myBarcode.Image;
Imports IronBarCode
Imports System.Drawing
' Reading a barcode is easy with IronBarcode!
Dim resultFromFile = BarcodeReader.Read("file/barcode.png") ' From a file
Dim resultFromBitMap = BarcodeReader.Read(New Bitmap("barcode.bmp")) ' From a bitmap
Dim resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")) ' From an image file
Dim resultFromPdf = BarcodeReader.ReadPdf("file/mydocument.pdf") ' From PDF use ReadPdf
' To configure and fine-tune barcode reading, utilize the BarcodeReaderOptions class
Dim myOptionsExample As New BarcodeReaderOptions With {
' Choose a reading speed from: Faster, Balanced, Detailed, ExtremeDetail
' There is a tradeoff in performance as more detail is set
.Speed = ReadingSpeed.Balanced,
' Reader will stop scanning once a single barcode is found (if set to true)
.ExpectMultipleBarcodes = True,
' By default, all barcode formats are scanned for
' Specifying a subset of barcode types to search for would improve performance
.ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
' Utilize multiple threads to read barcodes from multiple images in parallel
.Multithreaded = True,
' Maximum threads for parallelized barcode reading
' Default is 4
.MaxParallelThreads = 2,
' The area of each image frame in which to scan for barcodes
' Specifying a crop area will significantly improve performance and avoid noisy parts of the image
.CropArea = New Rectangle(),
' Special setting for Code39 barcodes
' If a Code39 barcode is detected, try to read with both the base and extended ASCII character sets
.UseCode39ExtendedMode = True
}
' Read with the options applied
Dim results = BarcodeReader.Read("barcode.png", myOptionsExample)
' Create a barcode with one line of code
Dim myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8)
' After creating a barcode, we may choose to resize
myBarcode.ResizeTo(400, 100)
' Save our newly-created barcode as an image
myBarcode.SaveAsImage("EAN8.jpeg")
' Get the barcode as an image for further processing
Dim myBarcodeImage = myBarcode.ImageImports IronBarCode
Imports System.Drawing
' Reading a barcode is easy with IronBarcode!
Dim resultFromFile = BarcodeReader.Read("file/barcode.png") ' From a file
Dim resultFromBitMap = BarcodeReader.Read(New Bitmap("barcode.bmp")) ' From a bitmap
Dim resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")) ' From an image file
Dim resultFromPdf = BarcodeReader.ReadPdf("file/mydocument.pdf") ' From PDF use ReadPdf
' To configure and fine-tune barcode reading, utilize the BarcodeReaderOptions class
Dim myOptionsExample As New BarcodeReaderOptions With {
' Choose a reading speed from: Faster, Balanced, Detailed, ExtremeDetail
' There is a tradeoff in performance as more detail is set
.Speed = ReadingSpeed.Balanced,
' Reader will stop scanning once a single barcode is found (if set to true)
.ExpectMultipleBarcodes = True,
' By default, all barcode formats are scanned for
' Specifying a subset of barcode types to search for would improve performance
.ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
' Utilize multiple threads to read barcodes from multiple images in parallel
.Multithreaded = True,
' Maximum threads for parallelized barcode reading
' Default is 4
.MaxParallelThreads = 2,
' The area of each image frame in which to scan for barcodes
' Specifying a crop area will significantly improve performance and avoid noisy parts of the image
.CropArea = New Rectangle(),
' Special setting for Code39 barcodes
' If a Code39 barcode is detected, try to read with both the base and extended ASCII character sets
.UseCode39ExtendedMode = True
}
' Read with the options applied
Dim results = BarcodeReader.Read("barcode.png", myOptionsExample)
' Create a barcode with one line of code
Dim myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8)
' After creating a barcode, we may choose to resize
myBarcode.ResizeTo(400, 100)
' Save our newly-created barcode as an image
myBarcode.SaveAsImage("EAN8.jpeg")
' Get the barcode as an image for further processing
Dim myBarcodeImage = myBarcode.Image
直接從我們的開發團隊獲得人性化支援
無論是產品、整合還是許可查詢,Iron產品開發團隊都隨時準備支援您的所有問題。與Iron聯繫,開始對話,以便在您的專案中充分利用我們的庫。在.NET Core、.NET Standard和.NET Framework中識別1D和2D條碼
IronBarcode 的 .NET 條碼資源庫可以讀取 BarcodeEncoding Enumb 中的任何類型條碼。它能夠識別 .NET Core、.NET Standard 和 .NET Framework 中的條碼。為了節省時間並提高庫存工作流程效率,IronBarcode 建議使用一維(1D)或線性條碼,這包括像 UPC 和 EAN 代碼這樣的傳統且已建立的條碼類型。全球的銷售點服務通常使用 UPC(通用產品代碼)條碼(包括其變體 UPC-A 和 UPC-E)。這使得目標消費者更容易在倉庫和結帳處識別和跟蹤產品特徵。UPCA 僅限於擁有 12 到 13 位數字的數字內容,而 UPCE 則支援 8 到 13 位數字的內容。
像 UPC 一樣,歐洲市場使用 EAN 條碼標籤消費品進行銷售點掃描。其變體包括 EAN-13 作為默認選擇,而 EAN-8 則適用於包裝空間有限的產品,例如糖果。除此之外,作為高密度條碼,EAN-13 可以緊湊地編碼較大的資料集。
1D 條碼不僅如此。
汽車和國防行業使用 Code 39 條碼。其名稱說明了其可以編碼 39 個字符的能力(現已修訂為 43 個)。同樣地,Code 128 字符集和高資料密度。繼續談物流,包裝行業更喜歡 ITF(交錯二值碼)條碼標籤包裝材料,例如瓦楞紙板,因為它們具有較高的印刷公差。而 MSI 更適合產品識別和庫存管理。
醫藥行業利用藥品二元編碼。而 RSS 14(減少空間的符號學)和 Databar 條碼是 1D 和 2D 條碼的混合體。這是醫療保健的最愛,以標記小物品。類似於 Code 128 條碼,Codabar 也受到物流和醫療保健行業的喜愛。它可以在沒有計算機的情況下工作,可從點陣打印機輸出中讀取。
2D 條碼包括 Aztec、Data Matrix、Data Bar、IntelligentMail、Maxicode、QR code。根據不同行業的使用,Aztec 在運輸行業中用於機票和登機牌,並且在較低的分辨率下也可讀。儘管 IntelligentMail 僅限於美國郵政中的特定用途,但 Maxicode 則用於標準化運輸跟蹤。
在所有條碼中最廣為人知的是 QR code。由於其靈活性,容錯率,可讀性,和支援多種資料類型(如數字,字母數字,字節/二進制和漢字),它具有大量用途,包括 B2B 和 B2C。
一旦確定了類型,IronBarcode — 領先的條碼生成器便開始接手!

開始你的條碼生成和讀取專案,使用 .NET 條碼讀取器
困難於 .NET 中的各種條碼類型讀取現在變得輕如鴻毛,使用 IronBarcode 的多功能、先進和高效的資源庫。要從哪裡開始?
安裝 IronBarcode 的 NuGet 包或手動將 DLL 安裝到您的項目或全局程序集緩存。您離生產一個 C# 條碼圖像掃描應用程式僅一步之遙。提取條碼圖片、數值、編碼類型、二進制資料(如果有的話),然後將其全部輸出到主控台。TryHarder - 更深入掃描失真條碼格式
將 IronBarcode 的 TryHarder 變量放到 QuicklyReadOneBarcode 方法中會讓應用程式更努力地、儘管會消耗更多時間,但更徹底地分析模糊、扭曲或損壞的 QR 代碼圖像格式。隨時指定多個格式
您可以指定您正在尋找的條碼編碼,或指定多個格式 - IronBarcode 賦予您無限的條碼分析工具。您可以提高條碼讀取的性能和準確性。您可以同時使用管道字符或 'Bitwize OR' 指定多種條碼格式。或者,通過使用 BarcodeReader.ReadASingleBarcode 方法來獲得更多的明確性和質量。
從 PDF 檔案讀取條碼,到掃描,到多線程處理
如果您的下一個專案是閱讀掃描的 PDF 文件並尋找所有的一維條碼,那麼再次使用 IronBarcode 不會讓您失望。這類似於從一個文檔中讀取一個條碼,只不過現在有關於條碼所屬頁面的附加信息。類似地,從多幀的 TIFF 也達到了相同的結果。在這方面,它被視為與 PDF 相似。
多線程是否困擾著您?如果是的話,IronBarcode 支援!
為了讀取多個檔案,您可以通過 IronBarcode 更好地完成,方法是創建一個檔案列表並使用 BarcodeReader.ReadBarcodesMultithreaded 方法。這利用多個線程,並有可能利用所有的 CPU 核心進行條碼掃描過程,速度可能比一次讀取一個條碼快很多倍。
對不完美圖像擔心不再屬於過去 — 完美條碼生成器
在現實中,用戶可能希望掃描一個不是完美的截圖或 PNG 圖片或照片。常規的開源 .NET 條碼生成器和讀取器資源庫將使任何少於完美的圖像格式的讀取變得不可能。然而,IronBarcode 使這變得非常簡單。QuicklyReadOneBarcode 的 TryHarder 方法導致 IronBarcode 能夠去除扭曲,並從不完美的數碼樣本中讀取條碼。
照片、掃描和縮略圖
如果一張照片是傾斜的,設置特定條碼旋轉和圖像校正以校正從手機相機合理預期的數字噪聲、坡度、透視和旋轉。同樣,從掃描的 PDF 中讀取 QR 代碼和 PDF-417 條碼需要設置合適的條碼旋轉校正水平和條碼圖像校正,以輕微清理文檔。然而,通過不過分指定和不破壞性能來進行警惕。
如果您有一個損壞的條碼縮略圖,則 IronBarcode 讀取方法會自動檢測過小的條碼圖像,然後進行放大,並清理與縮略圖相關的所有數字噪聲;使它們再次可讀。
開發人員無法更加輕鬆!
總結 IronBarcode - 用於創建和操控條碼圖像
由於IronBarcode方便創建、調整大小和保存各種條碼類型和格式,立即開始使用它絕對沒有理由!使用Fluent API,使用生成的條碼類來設置邊距、調整大小和註解條碼。然後保存為圖片,IronOCR會自動從文件名中假設正確的圖像類型。不論是GIF、HTML文件、HTML標籤、JPEG、PNG、TIFF和Windows位圖。
StampToExistingPdfPage方法允許生成條碼並將其蓋在現有PDF上。這在編輯通用PDF或通過條碼為文件添加內部識別號碼時非常有用。
立即連接24/7現場人員支援。無論您有什麼問題或需要專案支援;開始使用我們的30天試用金鑰,從我們易於理解的英文文檔資源中受益,或從我們999美元起的終身授權中受益。
支援:
C# 和 VB .NET 的條碼和 QR 教程

C#.NETBarCodeQR

讀取條碼和 QRs | C# VB .NET 教程
查看 Frank 如何在他的 C# .NET 條碼應用中使用 IronBarcode 從掃描、照片和 PDF 文檔中讀取條碼……
查看 Frank 的條碼閱讀教程
C#.NETBarCode

在 C# 或 VB.NET 中生成條碼圖像
Francesca 分享了一些在 C# 或 VB 應用程式中將條碼寫入圖像的提示和技巧。了解如何寫入條碼和 IronBarcode 提供的所有選項……
查看 Francesca 的條碼教程
QR.NETC#VB

在 C# 和 VB .NET 應用程式中寫入 QR 代碼教程
Jenny 的團隊每天使用 IronBarcode 寫入數千個 QR。查看他們的教程以充分利用 IronBarcode……
Jenny 團隊的 QR 編寫教程數千名開發者使用 IronBarcode 用於……
會計和財務系統
- # 收據
- # 報告
- # 發票列印
業務數位化
- # 文件
- # 訂單與標籤
- # 取代紙張

企業內容管理
- # 內容製作
- # 文件管理
- # 內容分發

資料和報告應用
- # 績效追蹤
- # 趨勢映射
- # 報告

數千個公司、政府、中小型企業和開發人員都信任 Iron 軟體產品。
Iron 的團隊有超過 10 年的 .NET 軟體組件市場經驗。








準備好開始了嗎?
NuGet 下載次數 2,564,559|版本:2026.11剛剛發布








