public static void ReadMultipleFromPdf() { // Multiple barcodes may be scanned up from a single document or image. A PDF document may also used as the input image PagedBarcodeResult[] PDFResults = BarcodeReader.ReadBarcodesFromPdf("MultipleBarcodes.pdf", BarcodeEncoding.All, BarcodeReader.BarcodeRotationCorrection.Low, BarcodeReader.BarcodeImageCorrection.None); // Work with the results foreach (var PageResult in PDFResults) { string Value = PageResult.Value; int PageNum = PageResult.PageNumber; System.Drawing.Bitmap Img = PageResult.BarcodeImage; BarcodeEncoding BarcodeType = PageResult.BarcodeType; byte[] Binary = PageResult.BinaryValue; Console.WriteLine(PageResult.Value + " on page " + PageNum); } }
public static void ReadMultipleFromTiffScan() { // Multi frame TIFF and GIF images can also be scanned, and multiple threads will be used automatically in the background for improved performance PagedBarcodeResult[] MultiFrameResults = BarcodeReader.ReadBarcodesFromMultiFrameTiff("Multiframe.tiff", BarcodeEncoding.AllOneDimensional, BarcodeReader.BarcodeRotationCorrection.High, BarcodeReader.BarcodeImageCorrection.MediumCleanPixels); // Work with the results foreach (var PageResult in MultiFrameResults) { string Value = PageResult.Value; int PageNum = PageResult.PageNumber; System.Drawing.Bitmap Img = PageResult.BarcodeImage; BarcodeEncoding BarcodeType = PageResult.BarcodeType; byte[] Binary = PageResult.BinaryValue; Console.WriteLine(PageResult.Value + " on page " + PageNum); } }
public static void ReadScanPDF() { // Best Results with a 200-300 DPI Scan. Specify a barcode format to avoid false positives in digital noise and text. // Multi frame TIFF and GIF images can also be scanned, and multiple threads will be used automatically in the background for improved performance var ScanResults = BarcodeReader.ReadBarcodesFromPdf("Scan.pdf", BarcodeEncoding.Code128 | BarcodeEncoding.ITF, BarcodeReader.BarcodeRotationCorrection.Low, BarcodeReader.BarcodeImageCorrection.MediumCleanPixels); // Work with the results foreach (var PageResult in ScanResults) { string Value = PageResult.Value; int PageNum = PageResult.PageNumber; System.Drawing.Bitmap Img = PageResult.BarcodeImage; BarcodeEncoding BarcodeType = PageResult.BarcodeType; byte[] Binary = PageResult.BinaryValue; Console.WriteLine(PageResult.Value + " on page " + PageNum); } }
public static void ReadPhotograpths() { // All BarcodeResult.Read methods provide the developer with control to correct image and photograph correction and straightening rotation and perspective from skewed images // * RotationCorrection e.g BarcodeReader.BarcodeRotationCorrection.Extreme un-rotates and removes perspective from barcode images. // * ImageCorrection e.g BarcodeReader.BarcodeImageCorrection.DeepCleanPixels separates Barcodes from background imagery and digital noise. // * BarcodeEncoding e.g. BarcodeEncoding.Code128 Setting a specific Barcode format improves speed and reduces the risk of false positive results // Example with a photo image var PhotoResult = BarcodeReader.ReadASingleBarcode("Photo.jpg", BarcodeEncoding.Code128, BarcodeReader.BarcodeRotationCorrection.Low, BarcodeReader.BarcodeImageCorrection.None); string Value = PhotoResult.Value; System.Drawing.Bitmap Img = PhotoResult.BarcodeImage; BarcodeEncoding BarcodeType = PhotoResult.BarcodeType; byte[] Binary = PhotoResult.BinaryValue; Console.WriteLine(PhotoResult.Value); }
public override Barcode Decode() { var t = ConfigurationManager.AppSettings["IronBarCode.LicenseKey"]; bool result = IronBarCode.License.IsLicensed; BarcodeResult QRResult = BarcodeReader.QuicklyReadOneBarcode(file); // Work with the results if (QRResult != null) { string value = QRResult.Value; Bitmap Img = QRResult.BarcodeImage; BarcodeEncoding BarcodeType = QRResult.BarcodeType; return(new Barcode(value, Img)); } return(null); }
public static void MultiThreading() { // The BarcodeResult.ReadBarcodesMultiThreaded method allows for faster barcode scanning of multiple images. All threads are automatically managed by IronBarCode. var ListOfDocuments = new[] { "image1.png", "image2.jpg", "image3.pdf" }; // The true flag at the end allows us to expect multiple barcodes per document. PagedBarcodeResult[] BatchResults = BarcodeReader.ReadBarcodesMultiThreaded(ListOfDocuments, BarcodeEncoding.All, true); // Work with the results foreach (var Result in BatchResults) { string Value = Result.Value; System.Drawing.Bitmap Img = Result.BarcodeImage; BarcodeEncoding BarcodeType = Result.BarcodeType; byte[] Binary = Result.BinaryValue; var InputFileName = ListOfDocuments[Result.PageNumber - 1]; Console.WriteLine(Result.Value + " found in file " + InputFileName); } }