C# Barcode Reader Library
How to read, recognize barcode from Adobe PDF file using C#?


Sample C# source code to scan, read barcode from scanned PDF, or editable PDF document using C# in ASP.NET, MVC, WinForms, WPF web and Windows apps.











Scan and reach barcode from PDF document in C#


Reading barcodes from PDF file is an easy job using XImage.Barcode Reader C# library.

  1. Customize barcode scanner options in ReaderSettings object. Such as barcode type as QR Code.
  2. Read and load the target PDF file into PDFDocument object
  3. Use BarcodeReader.ReadBarcodes() to recognize all barcodes from the PDF document



            ReaderSettings setting = new ReaderSettings();
            setting.AddTypesToRead(BarcodeType.QRCode);

            //  Open PDF file
            PDFDocument doc = new PDFDocument("C:/Input/RasterEdge.com/barcode-qrcode.pdf");

            Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, doc);

            foreach (Barcode aBarcode in barcodes)
            {
                Debug.WriteLine(aBarcode.Type + ": " + aBarcode.DataString);
            }




Read barcode from multi-page PDF page


You can also read barcodes from a single PDF page instead of all pages inside the PDF document in C#.

  1. Read barcodes from the PDFPage by using method BarcodeReader.ReadBarcodes()



            ReaderSettings setting = new ReaderSettings();
            setting.AddTypesToRead(BarcodeType.QRCode);

            //  Open PDF file
            PDFDocument doc = new PDFDocument("C:/Input/RasterEdge.com/barcode-qrcode.pdf");
            PDFPage firstPage = (PDFPage)doc.GetPage(0);

            Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, firstPage);

            foreach (Barcode aBarcode in barcodes)
            {
                Debug.WriteLine(aBarcode.Type + ": " + aBarcode.DataString);
            }