Fully-functional product
Get 30 days of fully-functional product.
Have it up and running in minutes.
using IronBarCode;
using System.Drawing;
// Creating a barcode is as simple as:
var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);
// And save our barcode as in image:
myBarcode.SaveAsImage("EAN8.jpeg");
Image myBarcodeImage = myBarcode.Image; // Can be used as Image
Bitmap myBarcodeBitmap = myBarcode.ToBitmap(); // Can be used as Bitmap
// 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
// After creating a barcode, we may choose to resize and save which is easily done with:
var myNewBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);
myNewBarcode.ResizeTo(400, 100);
myNewBarcode.SaveAsImage("myBarcodeResized.jpeg");
// To set more options and optimization with your Barcode Reading,
// Please utilize the BarcodeReaderOptions paramter of read:
var myOptionsExample = new BarcodeReaderOptions
{
// Choose a 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 barcode is found, unless set to true
ExpectMultipleBarcodes = true,
// By default, all barcode formats are scanned for.
// Specifying one or more, performance will increase.
ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
// Utilizes multiple threads to reads barcodes from multiple images in parallel.
Multithreaded = true,
// Maximum threads for parallel. Default is 4
MaxParallelThreads = 2,
// The area of each image frame in which to scan for barcodes.
// Will improve performance significantly and avoid unwanted results and avoid noisy parts of the image.
CropArea = new Rectangle(),
// Special Setting for Code39 Barcodes.
// If a Code39 barcode is detected. Try to use extended mode for the full ASCII Character Set
UseCode39ExtendedMode = true
};
// And, apply:
var results = BarcodeReader.Read("barcode.png", myOptionsExample);
Imports IronBarCode
Imports System.Drawing
' Creating a barcode is as simple as:
Private myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8)
' And save our barcode as in 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
' 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
Dim resultFromPdf = BarcodeReader.ReadPdf("file/mydocument.pdf") ' From PDF use ReadPdf
' After creating a barcode, we may choose to resize and save which is easily done with:
Dim myNewBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8)
myNewBarcode.ResizeTo(400, 100)
myNewBarcode.SaveAsImage("myBarcodeResized.jpeg")
' To set more options and optimization with your Barcode Reading,
' Please utilize the BarcodeReaderOptions paramter of read:
Dim myOptionsExample = New BarcodeReaderOptions With {
.Speed = ReadingSpeed.Balanced,
.ExpectMultipleBarcodes = True,
.ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
.Multithreaded = True,
.MaxParallelThreads = 2,
.CropArea = New Rectangle(),
.UseCode39ExtendedMode = True
}
' And, apply:
Dim results = BarcodeReader.Read("barcode.png", myOptionsExample)
The BarcodeWriter.CreateBarcode
class can be used to create barcodes and QR codes from strings, numbers, or binary data and encode to an appropriate format. We can then use the SaveAsImage()
method to export as an image, or other easy saving methods to save to a PDF, HTML, System.Drawing.Image
, stream, or Bitmap
object.
Likewise, we can read barcodes using the BarcodeReader
class. The easiest method to use is the BarcodeReader.Read
method, as shown above.
Do note all the various options set in BarcodeReaderOptions
that allow you to customize your reading to be faster, more intensive, stop scanning after reaching one barcode to save time, specify specific types of barcode to search for, and utilize multithreading, among other customization options.
using IronBarCode;
using IronSoftware.Drawing;
using System.Linq;
// Choose which filters are to be applied (in order);
var filtersToApply = new ImageFilterCollection() {
new SharpenFilter(),
new InvertFilter(),
new ContrastFilter(),
new BrightnessFilter(),
new AdaptiveThresholdFilter(),
new BinaryThresholdFilter()
};
BarcodeReaderOptions myOptionsExample = new BarcodeReaderOptions()
{
// Set chosen filters in BarcodeReaderOptions:
ImageFilters = filtersToApply,
// Other Barcode Reader Options:
Speed = ReadingSpeed.Balanced,
ExpectMultipleBarcodes = true,
};
// And, apply with a Read:
BarcodeResults results = BarcodeReader.Read("screenshot.png", myOptionsExample);
AnyBitmap[] filteredImages = results.FilterImages();
// Export file to disk
for (int i = 0 ; i < filteredImages.Count() ; i++)
filteredImages[i].SaveAs($"{i}_barcode.png");
// Or
results.ExportFilterImagesToDisk("filter-result.jpg");
Imports IronBarCode
Imports IronSoftware.Drawing
Imports System.Linq
' Choose which filters are to be applied (in order);
Private filtersToApply = New ImageFilterCollection() From {
New SharpenFilter(),
New InvertFilter(),
New ContrastFilter(),
New BrightnessFilter(),
New AdaptiveThresholdFilter(),
New BinaryThresholdFilter()
}
Private myOptionsExample As New BarcodeReaderOptions() With {
.ImageFilters = filtersToApply,
.Speed = ReadingSpeed.Balanced,
.ExpectMultipleBarcodes = True
}
' And, apply with a Read:
Private results As BarcodeResults = BarcodeReader.Read("screenshot.png", myOptionsExample)
Private filteredImages() As AnyBitmap = results.FilterImages()
' Export file to disk
For i As Integer = 0 To filteredImages.Count() - 1
filteredImages(i).SaveAs($"{i}_barcode.png")
Next i
' Or
results.ExportFilterImagesToDisk("filter-result.jpg")
IronBarcode has many filters to choose from that are easily applied in the BarcodeReaderOptions. Select the filters that may improve reading of your image such as Sharpen, Invert (colors), and Contrast. Please keep in mind that the order in which you choose them are the order that they are applied.
using IronBarCode;
using System.Drawing;
/*** CREATING BARCODE IMAGES *
Imports IronBarCode
Imports System.Drawing
'''* CREATING BARCODE IMAGES *
In this example we see that barcodes of many different types and formats can be created, resized, and saved; possibly even in a single line of code.
Using the Fluent API, the generated barcode class can be used to set margins, resize, and annotate barcodes. They may then be saved as images with IronOCR automatically assuming the correct image type from a file name: GIFs, HTML files, HTML tags, JPEGs, PDFs, PNGs, TIFFs, and Windows Bitmaps.
We also have the StampToExistingPdfPage
method, which allows a barcode to be generated and stamped onto an existing PDF. This is useful when editing a generic PDF or adding an internal identification number to a document via a barcode.
using IronBarCode;
using System;
using System.Drawing;
/*** STYING GENERATED BARCODES *
Imports IronBarCode
Imports System
Imports System.Drawing
'''* STYING GENERATED BARCODES *
In this sample, we see that barcodes may be annotated with text of your choosing or the barcode's own value using any typeface which is installed on the target machine. If that typeface is not available, an appropriate similar typeface will be chosen. Barcodes may be resized, have margins added, and both the barcode and the background may be recolored. They may then be saved as an appropriate format.
In the final few lines of code, you can see that using our fluent style operators, it's possible to create and style a barcode in only a few lines of code, similar to System.Linq
.
using IronBarCode;
/*** EXPORTING BARCODES AS HTML FILES OR TAGS *
Imports IronBarCode
'''* EXPORTING BARCODES AS HTML FILES OR TAGS *
Iron Barcode has a very useful feature allowing barcodes to be exported as HTML that is self-contained, such that it has no associated image assets. Everything is contained within the HTML file.
We may export as an HTML file, HTML image tag or to a data URI.
Whether it's product, integration or licensing queries, the Iron product development team is on hand to support all of your questions. Get in touch and start a dialog with Iron to make the most of our library in your project.
Ask a QuestionIronBarcode reads and generates the majority of barcode and QR standards including 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, and Aztec. Results provide barcode data, type, page, text, and barcode image; ideal for archive or indexing systems.
See Full Function ListIronBarcode automatically pre processes barcode images to improve speed and accuracy. Correcting rotation, noise, distortion and skewing to read scans or live video frames. Multi core, multi thread ready for batch processing server applications. Automatically find one or multiple barcodes in single and multi page documents. Search for specific barcode types or document locations without the need for complex APIs.
Learn MoreGet started in minutes with a few lines of code. Built for the .NET as an easy to use single DLL; without dependencies; supporting 32 & 64 bit; in any .NET Language. Use in Web, Cloud, Desktop or Console Applications; supporting Mobile & Desktop devices.
You can download the software product from this link.
Get Started NowSave or Print to a file or stream, as PDF, JPG, TIFF, GIF, BMP, PNG, or HTML formats. Set colour, quality, rotation, size and text. Use the C# Barcode Programming toolbox along with IronPDF and IronOCR for a full .NET Document Library.
Learn MoreFree community development licenses. Commercial licenses from $749.
C# .NET Barcode QR
See How Frank uses IronBarcode to Read Barcodes from Scans, Photos, & PDF documents inside his C# .NET Barcode Application...
View Frank's Barcode Reading TutorialC# .NET Barcode
Francesca shares some tips and tricks for writing Barcodes to Images in C# or VB Applications. See how to write the barcodes and all the options available to you with IronBarcode...
See Francesca's Barcode TutorialQR .NET C# VB
Jenny's Team use IronBarcode to write thousands of QRs per day. See their tutorial on getting the most out of IronBarcode...
QR Writing Tutorial from Jenny's TeamIron's team have over 10 years experience in the .NET software component market.