跳至頁尾內容
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;
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.Image
Install-Package BarCode

IronBarcode支持各種標準格式,從圖像文件(jpeg, png, 和 jpg)到更多程序化格式,您會希望在其中傳遞變量,如位圖。此外,它還支持外部格式比如PDF,使得IronBarcode可以無縫地整合到任何代碼庫中,為開發者提供靈活的文件格式和變數。

IronBarcode 除了是適用於所有檔案格式的 BarCode 讀取器外,同時也兼具 BarCode 生成器的功能,支援所有標準編碼與格式,例如 Code128 以及 Code39。 設定條碼產生器只需要兩行程式碼。 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 */ };`

條碼寫入器

我們首先導入必要的函式庫,例如 IronBarCodeSystem.Drawing,並實例化 BarcodeWriter,以 12345 的字串值和 EAN8 的格式建立 BARCODE。 然後我們將生成的條碼以所需格式儲存為圖像。 針對此功能有多種選項,因為 IronBarcode 支援將 BarCode 建立為 Image 以及 Bitmap

進階條碼寫入器

如上所見,使用IronBarcode生成條碼只需要兩行代碼,然後將其保存為文件以供日後使用。 IronBarcode通過為開發者提供大量選項以自定義條碼以適應情況進一步擴展這一點。

我們可以使用 ResizeTo 方法,並傳入高度和寬度來調整 BarCode 圖像的大小。

條碼閱讀器

如同上述,我們首先實例化 BarcodeReader,將檔案路徑傳遞給 Read 方法,並將其儲存為變數,以便日後使用並操作 BARCODE 物件。 針對讀取 PDF 等外部格式,有指定使用 ReadPDF 的方法; 然而,對於一般的圖像格式和位圖,我們會使用 Read

條碼讀取器選項

IronBarcode允許開發者從標準文件格式中掃描條碼。 然而,在某些情況下,開發人員可能希望微調 BarcodeReaderOptions 方法的行為,特別是在程式化讀取一批 BARCODE 檔案時。 這正是 BarcodeReaderOptions 派上用場之處。 IronBarcode 讓您能完全自訂各項設定,例如透過 Speed 設定讀取速度、透過 ExpectedMultipleBarcodes 設定檔案中是否預期包含多個 BARCODE,以及透過 ExpectBarcodeTypes 屬性設定 BARCODE 類型。 這樣一來,開發人員就可以運行多個執行緒來並行讀取多個映像中的條碼,還可以控制並行讀取時使用的執行緒數。

這些只是展示IronBarcode強大之處的一些屬性。 完整清單請參閱此處的文件。

透過我們的詳細指南,學習如何製作BarCode! Read

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 中。 請選擇有助於提升圖像可讀性的濾鏡,例如 Sharpen二值閾值Contrast。 請注意,您選擇的順序即為實際套用的順序。

系統提供選項,可儲存應用各濾鏡後的中間影像之圖像資料。 此功能可透過 SaveAtEachIterationImageFilterCollection 屬性進行切換。

精選程式碼範例的重點

  • 我們建立 BarcodeReaderOptions 的實例,並為其設定多種影像濾鏡:Binary Threshold 以及 Contrast
  • 篩選器是依照特定順序新增的,這代表了應套用的執行順序。
  • 透過將 cacheAtEachIteration 設定為 true,該函式庫會在每次套用濾鏡後儲存中間影像,這對於除錯與分析非常有用。
  • 最後,我們讀取圖片中的BARCODE,並將BARCODE類型與數值輸出至控制台。

進一步了解 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

在此範例中,我們可以看到可以建立、調整大小並儲存多種不同類型和格式的BarCode; 甚至可能僅需一行程式碼即可實現。

透過我們的流暢 API,生成的 barcode 類別可用於設定邊距、調整大小以及為 BARCODE 添加註解。 隨後可將其儲存為圖像,IronBarcode 會根據檔案名稱自動判讀正確的圖像類型:GIF、HTML 檔案、HTML 標籤、JPEG、PDF、PNG、TIFF 以及 Windows Bitmap

我們還提供 StampToExistingPdfPage 方法,可生成 BARCODE 並將其烙印至現有的 PDF 檔案上。 這在編輯通用 PDF 或透過 BARCODE 为文件添加內部識別號碼時非常實用。

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");

// 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.
Dim 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")

' 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 = 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

在此範例中,我們看到BARCODE可標註您自選的文字,或使用 barcode 本身的值,並採用目標機器上已安裝的任何字型。若該字型不可用,系統將選擇合適的相似字型。 BarCode 可調整大小、添加邊距,且 barcode 及背景顏色均可重新設定。 之後可將其儲存為適當的格式。

在最後幾行程式碼中,您可以看到透過使用我們的流暢風格運算子,僅需幾行程式碼即可建立並設定 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 具備一項非常實用的功能,可將 BarCode 匯出為自包含的 HTML 格式,因此無需依賴任何關聯的圖像資源。 所有內容均包含於 HTML 檔案中。

我們可將內容匯出為 HTML 檔案HTML 圖片標籤,或轉為資料 URI

在此範例中:

  • 我們使用 BarcodeWriter.CreateBarcode 建立 BARCODE,並指定輸入資料與編碼類型。
  • 接著,我們使用 IronBarcode 提供的各種方法來匯出 BARCODE:
  • ToHtmlTag() 會產生一個可嵌入網頁的 HTML <img> 標籤。
  • ToDataUri() 會產生一個資料 URI 字串,可用作 <img> 標籤的來源,或幾乎任何需要圖片網址的地方。
  • SaveAsHtmlFile() 會將 BARCODE 儲存為獨立的 HTML 檔案,並將所有圖像資料內嵌其中,使其具備可攜性且便於分享。

Human Support related to C# QR Code Library

來自我們開發團隊的直接人員支援

無論是產品、整合或授權問題,Iron 產品開發團隊都準備好支援您所有的問題。聯繫我們並與 Iron 進行對話,以發揮我們程式庫在您的計畫中的最大價值。

詢問問題
Recognizes Barcode Qr related to C# QR Code Library

發現多重 QR 碼類型

IronBarcode 讀取和生成大部分的條碼和 QR 標準,包括 UPC A/E、EAN 8/13、Code 39、Code 93、Code 128、ITF、MSI、RSS 14/Expanded、Databar、CodaBar、QR、Styled QR、Data Matrix、MaxiCode、PDF417、Plessey 和 Aztec。結果提供條碼數據、類型、頁面、文本和條碼影象;理想用於歸檔或索引系統。

查看更多功能列表
Fast And Polite Behavior related to C# QR Code Library

使用影像預處理的快速且準確讀取

IronBarcode 自動預處理條碼影像以提高速度和准確度。修正旋轉、噪音、失真和傾斜以讀取掃描或即時影片幀。多核、多執行緒已準備好批量處理伺服器應用程式。在單頁和多頁文件中自動尋找一或多個條碼。在不需要複雜的 API 情況下,搜索特定的條碼類型或文件位置。

了解更多
Built For Dot Net related to C# QR Code Library

為 .NET Core、Standard 及 Framework 專案輕鬆使用而建

僅需幾行代碼即可在幾分鐘內開始。針對 .NET 構建為一個易於使用的單個 DLL;無依賴性;支持 32 和 64 位;可用於任何 .NET 語言。用於網頁、雲端、桌面或控制台應用程式;支持移動和桌面裝置。

您可以從此 連結 下載軟體產品。

為 QR 構建, C#, .NET

立即開始
Write Barcodes related to C# QR Code Library

將 QR 碼寫入多個格式

保存或打印到文件或串流,作為 PDF、JPG、TIFF、GIF、BMP、PNG 或 HTML 格式。設置顏色、質量、旋轉、大小和文本。使用 C# 條碼編程工具箱以及 IronPDF 和 IronOCR 完整 .NET 文件程式庫。

了解更多
支持:
  • .NET Core 2.0 及以上版本
  • .NET Framework 4.0 及以上版本支持 C#、VB、F#
  • Microsoft Visual Studio。 .NET 開發 IDE 圖示
  • Microsoft Visual Studio 的 NuGet 安裝支持
  • 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 碼教程

讀取條碼的教學+代碼範例 | .NET 教程

C# .NET 條碼 QR

Frank Walker .NET 產品開發者

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

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

查看 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 Enterprise .NET 元件開發者

成千上萬的企業、政府、中小企業和開發者都信任 Iron 軟體產品。

Iron 團隊在 .NET 軟體元件市場擁有超過 10 年的經驗。

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

鋼鐵支援團隊

我們每週 5 天,每天 24 小時在線上。
聊天
電子郵件
打電話給我