IronOCR How-Tos Barcodes / QR (Over 20 Formats) How to Read Barcodes and QR Codes Chaknith Bin Updated:June 22, 2025 Reading barcodes and QR codes with OCR technology can be useful in scenarios where these codes are part of printed or digital documents and need to be automatically processed. It allows for automation and data extraction from a wide range of sources, making it a versatile solution for businesses and developers. IronOcr makes barcode and QR code detection automatic with only one additional setting needed to enable the detection. Get started with IronOCR Start using IronOCR in your project today with a free trial. First Step: Start for Free How to Read Barcodes and QR Codes Download a C# library to read barcodes and QR codes. Import the target image and PDF document. Enable barcode reading by setting the ReadBarCodes property to true. Use the Read method to perform OCR as usual. Output the detected text and barcode values. Read Barcode Example Construct the IronTesseract object to perform the reading. Enable barcode reading by setting the ReadBarCodes property to true. Import the PDF document by passing it into the OcrPdfInput constructor. Then, use the Read method to perform OCR on the imported PDF document. Now, let's perform OCR on the following PDF document: :path=/static-assets/ocr/content-code-examples/how-to/barcodes-read-barcodes.cs using IronOcr; using System; // Instantiate IronTesseract IronTesseract ocrTesseract = new IronTesseract(); // Enable barcode reading ocrTesseract.Configuration.ReadBarCodes = true; // Add PDF using var imageInput = new OcrPdfInput("pdfWithBarcodes.pdf"); // Perform OCR OcrResult ocrResult = ocrTesseract.Read(imageInput); // Output detected barcodes and text values Console.WriteLine("Extracted text:"); Console.WriteLine(ocrResult.Text); Console.WriteLine("Extracted barcodes:"); foreach (var barcode in ocrResult.Barcodes) { Console.WriteLine(barcode.Value); } Imports IronOcr Imports System ' Instantiate IronTesseract Private ocrTesseract As New IronTesseract() ' Enable barcode reading ocrTesseract.Configuration.ReadBarCodes = True ' Add PDF Dim imageInput = New OcrPdfInput("pdfWithBarcodes.pdf") ' Perform OCR Dim ocrResult As OcrResult = ocrTesseract.Read(imageInput) ' Output detected barcodes and text values Console.WriteLine("Extracted text:") Console.WriteLine(ocrResult.Text) Console.WriteLine("Extracted barcodes:") For Each barcode In ocrResult.Barcodes Console.WriteLine(barcode.Value) Next barcode $vbLabelText $csharpLabel As you can see, multiple barcode values that are also included in the extracted text are displayed below the barcodes. Read QR Code Example Similar to reading a barcode, the ReadBarCodes property must be set to true. Besides changing the file path, no other changes are necessary in the code. Now, let's perform OCR on the PDF document that has QR codes: :path=/static-assets/ocr/content-code-examples/how-to/barcodes-read-qr-codes.cs using IronOcr; using System; // Instantiate IronTesseract IronTesseract ocrTesseract = new IronTesseract(); // Enable barcode reading ocrTesseract.Configuration.ReadBarCodes = true; // Add PDF using var imageInput = new OcrPdfInput("pdfWithQrCodes.pdf"); // Perform OCR OcrResult ocrResult = ocrTesseract.Read(imageInput); // Output detected barcodes and text values Console.WriteLine("Extracted text:"); Console.WriteLine(ocrResult.Text); Console.WriteLine("Extracted barcodes:"); foreach (var barcode in ocrResult.Barcodes) { Console.WriteLine(barcode.Value); } Imports IronOcr Imports System ' Instantiate IronTesseract Private ocrTesseract As New IronTesseract() ' Enable barcode reading ocrTesseract.Configuration.ReadBarCodes = True ' Add PDF Dim imageInput = New OcrPdfInput("pdfWithQrCodes.pdf") ' Perform OCR Dim ocrResult As OcrResult = ocrTesseract.Read(imageInput) ' Output detected barcodes and text values Console.WriteLine("Extracted text:") Console.WriteLine(ocrResult.Text) Console.WriteLine("Extracted barcodes:") For Each barcode In ocrResult.Barcodes Console.WriteLine(barcode.Value) Next barcode $vbLabelText $csharpLabel Frequently Asked Questions What is OCR technology? IronOCR is a C# library that allows developers to read and decode barcodes and QR codes using OCR technology. It can be downloaded from NuGet. How do I set up a library for barcode and QR code reading? To set up IronOCR, download and set up a trial license from the NuGet website. Then, enable barcode reading by setting the ReadBarCodes property to true. How can I perform OCR on a PDF document with barcodes? Construct the IronTesseract object, enable barcode reading, import the PDF document using the OcrPdfInput constructor, and use the Read method to perform OCR. Output the detected text and barcode values from the result. Is there a difference between reading barcodes and QR codes? There is no difference in the process; both functionalities require setting the ReadBarCodes property to true. The file path is the only change needed between reading barcodes and QR codes. What types of documents can be processed with OCR technology? IronOCR can process both printed and digital documents, allowing for automation and data extraction from a wide range of sources. Can the library output both text and barcode values? Yes, IronOCR can output both the detected text and barcode values from the documents it processes. What is the ReadBarCodes property in the library? The ReadBarCodes property in IronOCR is a setting that, when set to true, enables the library to read and decode barcodes and QR codes from documents. How do I import a PDF document in the library? To import a PDF document in IronOCR, pass the document into the OcrPdfInput constructor before using the Read method to perform OCR. Chaknith Bin Chat with engineering team now Software Engineer Chaknith is the Sherlock Holmes of developers. It first occurred to him he might have a future in software engineering, when he was doing code challenges for fun. His focus is on IronXL and IronBarcode, but he takes pride in helping customers with every product. Chaknith leverages his knowledge from talking directly with customers, to help further improve the products themselves. His anecdotal feedback goes beyond Jira tickets and supports product development, documentation and marketing, to improve customer’s overall experience.When he isn’t in the office, he can be found learning about machine learning, coding and hiking. Ready to Get Started? Free NuGet Download Total downloads: 4,072,123 View Licenses