跳過到頁腳內容
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
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");

Image myBarcodeImage = myBarcode.Image; // Can be used as Image
Bitmap myBarcodeBitmap = myBarcode.ToBitmap(); // Can be used as Bitmap
Imports IronBarCode
Imports System.Drawing

' Reading a barcode is easy with IronBarcode!
Private resultFromFile = BarcodeReader.Read("file/barcode.png") ' From a file
Private resultFromBitMap = BarcodeReader.Read(New Bitmap("barcode.bmp")) ' From a bitmap
Private resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")) ' From an image
Private resultFromPdf = BarcodeReader.ReadPdf("file/mydocument.pdf") ' From PDF use ReadPdf

' To configure and fine-tune barcode reading, utilize the BarcodeReaderOptions class
Private myOptionsExample = New BarcodeReaderOptions With {
	.Speed = ReadingSpeed.Balanced,
	.ExpectMultipleBarcodes = True,
	.ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
	.Multithreaded = True,
	.MaxParallelThreads = 2,
	.CropArea = New Rectangle(),
	.UseCode39ExtendedMode = True
}

' Read with the options applied
Private results = BarcodeReader.Read("barcode.png", myOptionsExample)

' Create a barcode with one line of code
Private 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")

Dim myBarcodeImage As Image = myBarcode.Image ' Can be used as Image
Dim myBarcodeBitmap As Bitmap = myBarcode.ToBitmap() ' Can be used as Bitmap
Install-Package BarCode

IronBarCode 支援各種標準格式,從圖像文件(jpeg、png 和 jpg)到更程式化的格式,例如位圖,在這些格式中您可能希望傳遞變量。此外,IronBarCode 還支援如 PDF 等外部格式,可以在任何代碼庫中無縫集成,為開發者提供文件格式和變量的靈活性。

除了作為全文件格式的條形碼讀取器之外,IronBarcode 也同時作為條形碼生成器,支援所有標準編碼和格式化,例如 EAN8Code128Code39。 僅需兩行代碼即可設置條形碼生成器。 IronBarCode 以低門檻和豐富的定制選項使其成為所有條形碼相關情境的首選。

條形碼讀取器和條形碼生成器在 C# 中

  1. var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeEncoding.EAN8);
  2. Image myBarcodeImage = myBarcode.ToImage();
  3. myBarcode.ResizeTo(400, 100);
  4. var resultFromFile = BarcodeReader.Read(@"file/barcode.png");
  5. var myOptionsExample = new BarcodeReaderOptions { /* Options */ };
### 條形碼生成器 我們首先導入必要的庫,例如 `IronBarCode` 和 `System.Drawing`,並實例化 `BarcodeWriter` 以創建具有 `12345` 字符串值和 `EAN8` 格式的條形碼。 然後我們將生成的條形碼保存為所需格式的圖像。 有多種選擇,因為 IronBarCode 支援將條形碼創建為 `Image` 和 `Bitmap`。 #### 高級條形碼生成器 如上所見,使用 IronBarCode 生成條形碼只需兩行代碼,並將其保存為文件以供以後使用。 IronBarCode 通過為開發人員提供豐富的選項進一步擴展了此功能,以便定製條形碼以匹配情況。 我們可以使用 `ResizeTo` 方法並傳入高度和寬度來調整條形碼圖像的大小。 ### 條碼閱讀器 如上所述,我們首先實例化 `BarcodeReader`,將文件路徑傳遞給 `Read` 方法,並將其保存為變量以供以後使用並操作條形碼對象。 有指定的方法可以使用 `ReadPDF` 讀取外部格式如 PDF; 然而,對於一般的圖像格式和位圖,我們會使用 `Read`。 #### 條形碼讀取選項 IronBarCode 允許開發人員從標準文件格式掃描條形碼。 然而,開發人員可能需要微調 `Read` 方法的行為,尤其是在其程式化地讀取一批條形碼文件的情況下。 這時 `BarcodeReaderOptions` 就派上用場了。 IronBarCode 允許您全方位定制,例如使用 `Speed` 調整讀取速度,是否在文件中預期多個條形碼 `ExpectedMultipleBarcodes`,以及它們的條形碼類型是什麼 `ExpectBarcodeTypes`。 這允許開發人員運行多個線程從多個圖像中並行讀取條形碼,並控制執行並行讀取時使用的線程數。 這些只是 IronBarCode 強大功能的一部分。 有關完整列表,請參見文檔[此處](https://ironsoftware.com/csharp/barcode/object-reference/api/IronBarCode.BarcodeReaderOptions.html)。 使用我們的詳細指南學習創建條形碼!

C# + VB.NET: 不完美的條碼和圖像校正 不完美的條碼和圖像校正
using IronBarCode;
using IronSoftware.Drawing;

// Choose which filters are to be applied (in order)
// Set cacheAtEachIteration = true to save the intermediate image data after each filter is applied
var filtersToApply = new ImageFilterCollection(cacheAtEachIteration: true) {
    new SharpenFilter(),
    new InvertFilter(),
    new ContrastFilter(),
    new BrightnessFilter(),
    new AdaptiveThresholdFilter(),
    new BinaryThresholdFilter(),
    new GaussianBlurFilter(),
    new MedianBlurFilter(),
    new BilateralFilter()
};

BarcodeReaderOptions myOptionsExample = new BarcodeReaderOptions()
{
    // Set chosen filters in BarcodeReaderOptions
    ImageFilters = filtersToApply,

    Speed = ReadingSpeed.Balanced,
    ExpectMultipleBarcodes = true,
};

// Read with the options applied
BarcodeResults results = BarcodeReader.Read("screenshot.png", myOptionsExample);

AnyBitmap[] filteredImages = results.FilterImages();

// Export intermediate image files to disk
for (int i = 0 ; i < filteredImages.Length ; i++)
    filteredImages[i].SaveAs($"{i}_barcode.png");

// Or
results.ExportFilterImagesToDisk("filter-result.jpg");
Imports IronBarCode
Imports IronSoftware.Drawing

' Choose which filters are to be applied (in order)
' Set cacheAtEachIteration = true to save the intermediate image data after each filter is applied
Private filtersToApply = New ImageFilterCollection(cacheAtEachIteration:= True) From {
	New SharpenFilter(),
	New InvertFilter(),
	New ContrastFilter(),
	New BrightnessFilter(),
	New AdaptiveThresholdFilter(),
	New BinaryThresholdFilter(),
	New GaussianBlurFilter(),
	New MedianBlurFilter(),
	New BilateralFilter()
}

Private myOptionsExample As New BarcodeReaderOptions() With {
	.ImageFilters = filtersToApply,
	.Speed = ReadingSpeed.Balanced,
	.ExpectMultipleBarcodes = True
}

' Read with the options applied
Private results As BarcodeResults = BarcodeReader.Read("screenshot.png", myOptionsExample)

Private filteredImages() As AnyBitmap = results.FilterImages()

' Export intermediate image files to disk
For i As Integer = 0 To filteredImages.Length - 1
	filteredImages(i).SaveAs($"{i}_barcode.png")
Next i

' Or
results.ExportFilterImagesToDisk("filter-result.jpg")
Install-Package BarCode

IronBarcode 提供許多可以選擇的圖像預處理過濾器,這些過濾器可以輕鬆應用在 BarcodeReaderOptions 中。 選擇可能改善圖片讀取的過濾器,如 銳化二元閾值對比度。 請記住,選擇它們的順序即為它們被應用的順序。

有一個選項允許在應用每個過濾器後保存中間圖像的圖像數據。 這可以借由 ImageFilterCollectionSaveAtEachIteration 屬性來切換。

從範例代碼案例中得出的關鍵點:

  • 我們創建了一個 BarcodeReaderOptions 實例並配置了不同的圖像過濾器: SharpenBinary ThresholdContrast
  • 過濾器是以特定順序添加的,顯示了它們應被應用的順序。
  • 通過將 cacheAtEachIteration 設置為 true,該庫在每次應用過濾器後保存中間圖像,這對於調試和分析非常有用。
  • 最後,我們從圖片中讀取條形碼並將條形碼類型和值打印到控制台。

了解更多有關 IronBarcode 中圖片校正的信息

C# + VB.NET: 創建條碼圖像 創建條碼圖像
using IronBarCode;
using System.Drawing;

/*** CREATING BARCODE IMAGES ***/

// Create and save a barcode in a single line of code
BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8).ResizeTo(400, 100).SaveAsImage("EAN8.jpeg");

/*****  IN-DEPTH BARCODE CREATION OPTIONS *****/

// BarcodeWriter.CreateBarcode creates a GeneratedBarcode which can be styled and exported as an Image object or file
GeneratedBarcode MyBarCode = BarcodeWriter.CreateBarcode("Any Number, String or Binary Value", BarcodeWriterEncoding.Code128);

// Style the Barcode in a fluent LINQ-style fashion
MyBarCode.ResizeTo(300, 150).SetMargins(20).AddAnnotationTextAboveBarcode("Example EAN8 Barcode").AddBarcodeValueTextBelowBarcode();
MyBarCode.ChangeBackgroundColor(Color.LightGoldenrodYellow);

// Save the barcode as an image file
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");

// Save the barcode as a .NET native object
Image MyBarCodeImage = MyBarCode.Image;
Bitmap MyBarCodeBitmap = MyBarCode.ToBitmap();

byte[] PngBytes = MyBarCode.ToPngBinaryData();

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

// Save MyBarCode as an HTML file or tag
MyBarCode.SaveAsHtmlFile("MyBarCode.Html");
string ImgTagForHTML = MyBarCode.ToHtmlTag();
string DataURL = MyBarCode.ToDataUrl();

// Save MyBarCode to a new PDF, or stamp it in any position on any page(s) of an existing document
MyBarCode.SaveAsPdf("MyBarCode.Pdf");
MyBarCode.StampToExistingPdfPage("ExistingPDF.pdf", 200, 50, 1);  // Position (200, 50) on page 1
MyBarCode.StampToExistingPdfPages("ExistingPDF.pdf", 200, 50, new[] { 1, 2, 3 }, "Password123");  // Multiple pages of an encrypted PDF
Imports IronBarCode
Imports System.Drawing

'''* CREATING BARCODE IMAGES **

' Create and save a barcode in a single line of code
BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8).ResizeTo(400, 100).SaveAsImage("EAN8.jpeg")

'''***  IN-DEPTH BARCODE CREATION OPTIONS ****

' BarcodeWriter.CreateBarcode creates a GeneratedBarcode which can be styled and exported as an Image object or file
Dim MyBarCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("Any Number, String or Binary Value", BarcodeWriterEncoding.Code128)

' Style the Barcode in a fluent LINQ-style fashion
MyBarCode.ResizeTo(300, 150).SetMargins(20).AddAnnotationTextAboveBarcode("Example EAN8 Barcode").AddBarcodeValueTextBelowBarcode()
MyBarCode.ChangeBackgroundColor(Color.LightGoldenrodYellow)

' Save the barcode as an image file
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")

' Save the barcode as a .NET native object
Dim MyBarCodeImage As Image = MyBarCode.Image
Dim MyBarCodeBitmap As Bitmap = MyBarCode.ToBitmap()

Dim PngBytes() As Byte = MyBarCode.ToPngBinaryData()

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

' Save MyBarCode as an HTML file or tag
MyBarCode.SaveAsHtmlFile("MyBarCode.Html")
Dim ImgTagForHTML As String = MyBarCode.ToHtmlTag()
Dim DataURL As String = MyBarCode.ToDataUrl()

' Save MyBarCode to a new PDF, or stamp it in any position on any page(s) of an existing document
MyBarCode.SaveAsPdf("MyBarCode.Pdf")
MyBarCode.StampToExistingPdfPage("ExistingPDF.pdf", 200, 50, 1) ' Position (200, 50) on page 1
MyBarCode.StampToExistingPdfPages("ExistingPDF.pdf", 200, 50, { 1, 2, 3 }, "Password123") ' Multiple pages of an encrypted PDF
Install-Package BarCode

在這個例子中,我們看到可以創建、調整大小和保存許多不同類型和格式的條碼; 可能甚至只需一行代碼。

使用我們的流暢的 API,生成的條碼類可以用來設置邊距、調整大小和註釋條碼。 然後,它們可以保存為圖像,IronBarcode會自動從文件名稱假設正確的圖像類型:GIFs,HTML文件,HTML標籤,JPEGs,PDFs,PNGs,TIFFs,和Windows位圖。

我們還有StampToExistingPdfPage方法,可以生成條碼並將其加蓋在現有的PDF上。 這在編輯通用PDF或通過條碼將內部識別號添加到文件時很有用。

C# + VB.NET: 條形碼樣式和註釋 條形碼樣式和註釋
using IronBarCode;
using System;
using System.Drawing;

/*** STYLING GENERATED BARCODES  ***/

// BarcodeWriter.CreateBarcode creates a GeneratedBarcode object which allows the barcode to be styled and annotated.
GeneratedBarcode MyBarCode = BarcodeWriter.CreateBarcode("Iron Software", BarcodeWriterEncoding.QRCode);

// Any text (or commonly, the value of the barcode) can be added to the image in a default or specified font.
// Text positions are automatically centered, above or below. Fonts that are too large for a given image are automatically scaled down.
MyBarCode.AddBarcodeValueTextBelowBarcode();
MyBarCode.AddAnnotationTextAboveBarcode("This is My Barcode", new Font(new FontFamily("Arial"), 12, FontStyle.Regular, GraphicsUnit.Pixel), Color.DarkSlateBlue);

// Resize, add margins and check final image dimensions
MyBarCode.ResizeTo(300, 300); // Resize in pixels
MyBarCode.SetMargins(0, 20, 0, 20); // Set margins in pixels

int FinalWidth = MyBarCode.Width;
int FinalHeight = MyBarCode.Height;

// Recolor the barcode and its background
MyBarCode.ChangeBackgroundColor(Color.LightGray);
MyBarCode.ChangeBarCodeColor(Color.DarkSlateBlue);
if (!MyBarCode.Verify())
{
    Console.WriteLine("Color contrast should be at least 50% or a barcode may become unreadable. Test using GeneratedBarcode.Verify()");
}

// Finally, save the result
MyBarCode.SaveAsHtmlFile("StyledBarcode.html");

/*** STYLING BARCODES IN A SINGLE LINQ-STYLE EXPRESSION ***/

// Create a barcode in one line of code
BarcodeWriter.CreateBarcode("https://ironsoftware.com", BarcodeWriterEncoding.Aztec).ResizeTo(250, 250).SetMargins(10).AddBarcodeValueTextAboveBarcode().SaveAsImage("StyledBarcode.png");

/*** STYLING QR CODES WITH LOGO IMAGES OR BRANDING ***/

// Use the QRCodeWriter.CreateQrCodeWithLogo Method instead of BarcodeWriter.CreateBarcode
// Logo will automatically be sized appropriately and snapped to the QR grid.

var qrCodeLogo = new QRCodeLogo("ironsoftware_logo.png");
GeneratedBarcode myQRCodeWithLogo = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/", qrCodeLogo);
myQRCodeWithLogo.ResizeTo(500, 500).SetMargins(10).ChangeBarCodeColor(Color.DarkGreen);
myQRCodeWithLogo.ResizeTo(500, 500).SetMargins(10).ChangeBarCodeColor(Color.DarkGreen);
myQRCodeWithLogo.SaveAsPng("QRWithLogo.Png").SaveAsPdf("MyVerifiedQR.html"); // Save as 2 different formats
Imports IronBarCode
Imports System
Imports System.Drawing

'''* STYLING GENERATED BARCODES  **

' BarcodeWriter.CreateBarcode creates a GeneratedBarcode object which allows the barcode to be styled and annotated.
Private MyBarCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("Iron Software", BarcodeWriterEncoding.QRCode)

' Any text (or commonly, the value of the barcode) can be added to the image in a default or specified font.
' Text positions are automatically centered, above or below. Fonts that are too large for a given image are automatically scaled down.
MyBarCode.AddBarcodeValueTextBelowBarcode()
MyBarCode.AddAnnotationTextAboveBarcode("This is My Barcode", New Font(New FontFamily("Arial"), 12, FontStyle.Regular, GraphicsUnit.Pixel), Color.DarkSlateBlue)

' Resize, add margins and check final image dimensions
MyBarCode.ResizeTo(300, 300) ' Resize in pixels
MyBarCode.SetMargins(0, 20, 0, 20) ' Set margins in pixels

Dim FinalWidth As Integer = MyBarCode.Width
Dim FinalHeight As Integer = MyBarCode.Height

' Recolor the barcode and its background
MyBarCode.ChangeBackgroundColor(Color.LightGray)
MyBarCode.ChangeBarCodeColor(Color.DarkSlateBlue)
If Not MyBarCode.Verify() Then
	Console.WriteLine("Color contrast should be at least 50% or a barcode may become unreadable. Test using GeneratedBarcode.Verify()")
End If

' Finally, save the result
MyBarCode.SaveAsHtmlFile("StyledBarcode.html")

'''* STYLING BARCODES IN A SINGLE LINQ-STYLE EXPRESSION **

' Create a barcode in one line of code
BarcodeWriter.CreateBarcode("https://ironsoftware.com", BarcodeWriterEncoding.Aztec).ResizeTo(250, 250).SetMargins(10).AddBarcodeValueTextAboveBarcode().SaveAsImage("StyledBarcode.png")

'''* STYLING QR CODES WITH LOGO IMAGES OR BRANDING **

' Use the QRCodeWriter.CreateQrCodeWithLogo Method instead of BarcodeWriter.CreateBarcode
' Logo will automatically be sized appropriately and snapped to the QR grid.

Dim qrCodeLogo As New QRCodeLogo("ironsoftware_logo.png")
Dim myQRCodeWithLogo As GeneratedBarcode = QRCodeWriter.CreateQrCodeWithLogo("https://ironsoftware.com/", qrCodeLogo)
myQRCodeWithLogo.ResizeTo(500, 500).SetMargins(10).ChangeBarCodeColor(Color.DarkGreen)
myQRCodeWithLogo.ResizeTo(500, 500).SetMargins(10).ChangeBarCodeColor(Color.DarkGreen)
myQRCodeWithLogo.SaveAsPng("QRWithLogo.Png").SaveAsPdf("MyVerifiedQR.html") ' Save as 2 different formats
Install-Package BarCode

在此範例中,我們看到條碼可以使用您選擇的文本或條碼本身的值進行註解,並採用安裝在目標機器上的任何字型。如果該字型不可用,將選擇一個合適的相似字型。 條碼可以大小調整、有邊距添加,條碼和背景都可以重新上色。 然後可以將它們保存為合適的格式。

在代碼的最後幾行中,您可以看到使用我們的流暢風格運算符,可以在僅幾行代碼內創建和設計條碼,這與System.Linq類似。

C# + VB.NET: 將條碼匯出為HTML 將條碼匯出為HTML
using IronBarCode;

GeneratedBarcode MyBarCode = BarcodeWriter.CreateBarcode("1234567890", BarcodeWriterEncoding.Code128);

// Save as a stand-alone HTML file without any image assets
MyBarCode.SaveAsHtmlFile("MyBarCode.html");

// Save as a stand-alone HTML image tag which can be served in HTML files, ASPX or MVC Views. No image assets required, the tag embeds the entire image in its source content
string ImgTag = MyBarCode.ToHtmlTag();

// Turn the image into a HTML/CSS Data URI.
string DataURI = MyBarCode.ToDataUrl();
Imports IronBarCode

Private MyBarCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("1234567890", BarcodeWriterEncoding.Code128)

' Save as a stand-alone HTML file without any image assets
MyBarCode.SaveAsHtmlFile("MyBarCode.html")

' Save as a stand-alone HTML image tag which can be served in HTML files, ASPX or MVC Views. No image assets required, the tag embeds the entire image in its source content
Dim ImgTag As String = MyBarCode.ToHtmlTag()

' Turn the image into a HTML/CSS Data URI.
Dim DataURI As String = MyBarCode.ToDataUrl()
Install-Package BarCode

IronBarcode具有一個非常有用的功能,允許將條碼導出為自包含的HTML,因此它沒有相關的圖像資產。 所有內容都包含在HTML文件中。

我們可以導出為HTML文件HTML圖像標籤數據URI

根據此示例:

  • 我們使用BarcodeWriter.CreateBarcode創建條碼,指定輸入數據和編碼類型。
  • 然後我們使用IronBarcode提供的不同方法來導出條碼:
  • ToHtmlTag()生成一個可以嵌入在網頁中的HTML<img>標籤。
  • ToDataUri()創建一個數據URI字符串,可以用作<img>標籤的來源,或者幾乎可以在任何需要圖像URL的地方使用。
  • SaveAsHtmlFile()將條碼保存為獨立的HTML文件,內含所有圖像數據,使其便攜且易於分享。

Human Support related to .NET條形碼庫

直接從我們的開發團隊獲得人性化支持

無論是產品、集成還是許可問題,Iron 產品開發團隊隨時支持您的所有問題。與 Iron 取得聯繫,開始對話,以便在項目中充分利用我們的庫。

提問
Recognizes Barcode Qr related to .NET條形碼庫

識別 .NET Core、.NET Standard 和 .NET Framework 中的一維和二維條碼

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 — 領先的條碼生成器便開始接手!

查看完整功能列表
Fast And Polite Behavior related to .NET條形碼庫

開始你的條碼生成和讀取專案,使用 .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 讀取方法會自動檢測過小的條碼圖像,然後進行放大,並清理與縮略圖相關的所有數字噪聲;使它們再次可讀。

開發人員無法更加輕鬆!

了解更多
Built For Dot Net related to .NET條形碼庫

為容易使用在 .NET Core 專案而建立

用幾行代碼即可在幾分鐘內開始。為 .NET Core、.NET Standard 和 Framework 構建,作為易於使用的單一 DLL;沒有依賴性;支援 32 和 64 位;在任何 .NET 語言中。在 Web、雲端、桌面或控制台應用中使用;支持移動和桌面設備。您可以從此鏈接下載此軟件產品。

為 .NET 構建, C#, QR 碼

立即開始
Write Barcodes related to .NET條形碼庫

總結 IronBarcode - 用於創建和操控條碼圖像

由於 IronBarcode 促使各種條碼類型和格式的創建、調整大小和保存,無理由不立即開始!

使用 Fluent API,使用生成的條碼類設置邊距、調整大小和註釋條碼。然後用 IronOCR 自動根據檔名假設正確的圖像類型保存為圖像。無論是 GIF、HTML 文件、HTML 標籤、JPEG、PNG、TIFF 和 Windows 位圖。

StampToExistingPdfPage 方法允許生成條碼並將其蓋章到現有的 PDF 中。這在編輯通用 PDF 或通過條碼添加內部識別碼到文件中時非常有用。

立刻與 24/7 人工支持進行聯系。無論您有任何問題或需要專案支持;開始使用我們的 30 天試用金鑰、從我們的廣泛英文文檔資源中獲益,或從 749 美元起購買我們的終身許可證。

了解更多
支持:
  • .NET Core 2.0 及以上
  • .NET Framework 4.0 及以上支持 C#、VB、F#
  • Microsoft Visual Studio. .NET 開發 IDE 圖標
  • NuGet 安装支持 Visual Studio
  • 兼容 JetBrains ReSharper C# 語言助手
  • 兼容 Microsoft Azure C# .NET 托管平台

授權與定價

免費 社區開發許可證。商業許可證從 $749 開始。

项目 C# + VB.NET 库许可

項目

開發者 C# + VB.NET 庫授權

開發者

組織 C# + VB.NET 庫授權

組織

代理 C# + VB.NET 庫授權

代理

SaaS C# + VB.NET 庫授權

SaaS

OEM C# + VB.NET 庫授權

OEM

查看完整的許可選項  

C# 和 VB .NET 的條碼和 QR 教程

教程 + C# 中讀取條碼的代碼範例 | .NET 教程

C# .NET 條形碼 QR

Frank Walker .NET 產品開發人員

讀取條碼和 QRs | C# VB .NET 教程

看看 Frank 如何使用 IronBarcode 從掃描件、照片 和 PDF 文件中讀取條碼,在他的 C# .NET 條碼應用程式中……

查看 Frank 的條碼閱讀教程
在 C# 和 VB.NET 中寫入條碼教程 + 代碼範例

C# .NET 條形碼

Francesca Miller 初級 .NET 工程師

在 C# 或 VB.NET 中生成條碼圖像

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

查看 Francesca 的條碼教程
教程 + 代碼示例 VB.NET PDF 創建與編輯 | VB.NET & ASP.NET PDF

QR .NET C# VB

Jennifer Wright 應用架構負責人

在 C# 和 VB .NET 應用程式中寫入 QR 代碼教程

Jenny 的團隊每天使用 IronBarcode 寫入數千個 QR。查看他們的教程以充分利用 IronBarcode……

Jenny 團隊的 QR 編寫教程
數千名開發者使用 IronBarcode 用於……

會計和財務系統

  • # 收據
  • # 報告
  • # 發票打印
向 ASP.NET 會計和財務系統添加 PDF 支持

商務數字化

  • # 文件
  • # 訂單和標籤
  • # 紙質替代
C# 商務數字化用例

企業內容管理

  • # 內容生產
  • # 文档管理
  • # 內容分發
.NET CMS PDF 支持

數據和報告應用

  • # 性能跟踪
  • # 趨勢映射
  • # 報告
C# PDF 報告
Iron Software 企業 .NET 組件開發者

數千個公司、政府、中小型企業和開發人員都信任 Iron 軟件產品。

Iron 的團隊有超過 10 年的 .NET 軟件組件市場經驗。

Iron 客戶圖標
Iron 客戶圖標
Iron 客戶圖標
Iron 客戶圖標
Iron 客戶圖標
Iron 客戶圖標
Iron 客戶圖標
Iron 客戶圖標