using IronBarCode;
using System.Drawing; // Include a reference to System.Drawing.Dll
/*** READING BARCODES & BARCODEENCODING ***/
// When reading a barcode we can select One or Many IronBarCode.BarcodeEncoding to read. The fewer chosen the faster the results.
BarcodeResult ResultOneFormat = BarcodeReader.QuicklyReadOneBarcode("QuickStart.jpg", BarcodeEncoding.Rss14); // 1 format selected
// Multiple formats can selected using the Bitwise OR (| pipe) operator.
BarcodeResult ResultMultiFormat = BarcodeReader.QuicklyReadOneBarcode("QuickStart.jpg", BarcodeEncoding.Rss14 | BarcodeEncoding.UPCA | BarcodeEncoding.QRCode);
// Not specifying a BarcodeEncoding will attempt to read every known type of barcode which is slower and may lead to false positive results in noisy images occasionally
BarcodeResult ResultAnyFormat = BarcodeReader.QuicklyReadOneBarcode("QuickStart.jpg");
/*** WRITING BARCODES & BARCODEWRITERENCODING ***/
// When creating a barcode we must choose ONE type of barcode using a IronBarCode.BarcodeWriterEncoding
GeneratedBarcode MyBarCode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.UPCA);
// SUPPORTED BARCODE FORMATS:
// * QR Codes including decorated QR Codes with Logos and colors
// * Multi-Format Barcodes: Aztec, Data Matrix, Code 93 and Code 128
// * RSS Expanded "Databar", UPS MaxiCode and USPS IMB OneCode Barcodes (Read-Only)
// * Linear Stacked Barcodes: RSS14 & PDF417
// * Numerical Formats: UPC-A, UPC-E, EAN-8, EAN-13, Codabar, ITF, MSI & Plessey
// BARCODE FORMAT ERROR CORRECTION:
// * BarcodeWriter will automatically check and correct/add Checksums to UPC-A and UPC-E barcodes
// * BarcodeWriter will automatically 'zero pad' numbers which are too short for any fixed length numeric format such as UPC-A
// * If your data can not be encoded to a specific BarcodeWriterEncoding, an IronBarcodeEncodingError with detailed instructions to solve the issue will be raised.
/*** BARCODE EXPORT FORMATS ***/
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");
Image MyBarCodeImage = MyBarCode.Image;
Bitmap MyBarCodeBitmap = MyBarCode.ToBitmap();
byte[] PngBytes = MyBarCode.ToPngBinaryData();
System.IO.Stream PngStream = MyBarCode.ToStream();
System.IO.Stream PdfStream = MyBarCode.ToPdfStream();
string ImgTagForHTML = MyBarCode.ToHtmlTag();
MyBarCode.SaveAsPdf("MyBarCode.Pdf");
MyBarCode.StampToExistingPdfPage("ExistingPDF.pdf", 200, 50, 1); // position 200x50 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 ' Include a reference to System.Drawing.Dll
'''* READING BARCODES & BARCODEENCODING **
' When reading a barcode we can select One or Many IronBarCode.BarcodeEncoding to read. The fewer chosen the faster the results.
Private ResultOneFormat As BarcodeResult = BarcodeReader.QuicklyReadOneBarcode("QuickStart.jpg", BarcodeEncoding.Rss14) ' 1 format selected
' Multiple formats can selected using the Bitwise OR (| pipe) operator.
Private ResultMultiFormat As BarcodeResult = BarcodeReader.QuicklyReadOneBarcode("QuickStart.jpg", BarcodeEncoding.Rss14 Or BarcodeEncoding.UPCA Or BarcodeEncoding.QRCode)
' Not specifying a BarcodeEncoding will attempt to read every known type of barcode which is slower and may lead to false positive results in noisy images occasionally
Private ResultAnyFormat As BarcodeResult = BarcodeReader.QuicklyReadOneBarcode("QuickStart.jpg")
'''* WRITING BARCODES & BARCODEWRITERENCODING **
' When creating a barcode we must choose ONE type of barcode using a IronBarCode.BarcodeWriterEncoding
Private MyBarCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.UPCA)
' SUPPORTED BARCODE FORMATS:
' * QR Codes including decorated QR Codes with Logos and colors
' * Multi-Format Barcodes: Aztec, Data Matrix, Code 93 and Code 128
' * RSS Expanded "Databar", UPS MaxiCode and USPS IMB OneCode Barcodes (Read-Only)
' * Linear Stacked Barcodes: RSS14 & PDF417
' * Numerical Formats: UPC-A, UPC-E, EAN-8, EAN-13, Codabar, ITF, MSI & Plessey
' BARCODE FORMAT ERROR CORRECTION:
' * BarcodeWriter will automatically check and correct/add Checksums to UPC-A and UPC-E barcodes
' * BarcodeWriter will automatically 'zero pad' numbers which are too short for any fixed length numeric format such as UPC-A
' * If your data can not be encoded to a specific BarcodeWriterEncoding, an IronBarcodeEncodingError with detailed instructions to solve the issue will be raised.
'''* BARCODE EXPORT FORMATS **
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")
Dim MyBarCodeImage As Image = MyBarCode.Image
Dim MyBarCodeBitmap As Bitmap = MyBarCode.ToBitmap()
Dim PngBytes() As Byte = MyBarCode.ToPngBinaryData()
Dim PngStream As System.IO.Stream = MyBarCode.ToStream()
Dim PdfStream As System.IO.Stream = MyBarCode.ToPdfStream()
Dim ImgTagForHTML As String = MyBarCode.ToHtmlTag()
MyBarCode.SaveAsPdf("MyBarCode.Pdf")
MyBarCode.StampToExistingPdfPage("ExistingPDF.pdf", 200, 50, 1) ' position 200x50 on page 1
MyBarCode.StampToExistingPdfPages("ExistingPDF.pdf", 200, 50, { 1, 2, 3 }, "Password123") ' multiple pages of an encrypted PDF