Tech Specs
How-to C#
How-to VB.NET
C# PDF: How to HTML5 Viewer & Editor PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF Viewer & Editor Work with Other SDKs Barcode Read Barcode Create OCR Twain
Barcode Read
Home ›› XDoc.PDF ›› C# PDF: Read Barcode

C#.NET PDF - Read Barcode on PDF in C#.NET

Using C# Code to Scan 1D and 2D Barcodes on PDF Document Page in C#.NET Application

C# PDF Barcode Reading Overview

C#.NET PDF Barcode Reader & Scanner Controls from RasterEdge DocImage SDK for .NET is a professional barcode detecting and decoding library toolkit designed specifically for linear and 2d barcodes reading, scanning and recognition from PDF document files in C#.NET class applications.

Main features about C#.NET PDF Barcode Reader:

Read & scan most 1d and 2d barcodes from PDF document using C# code in .NET

Detect & decode barcode from whole or partial PDF document page using C#.NET

Recognize barcode from PDF document and return decoded barcode value to data string

Speed up barcode reading rate from PDF by limiting detected barcode number using C#.NET code

Support multi-threaded barcode recognition from PDF with high performance

Recognized barcode value will be returned with 100% accuracy

Sample Code for C#.NET PDF Barcode Recognition

Add necessary references:










Use corresponding namespaces;

  using RasterEdge.Imaging.Basic;

  using RasterEdge.XDoc.PDF;

  using RasterEdge.XImage.BarcodeScanner;

Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:


       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.


       If using x86, the platform target should be x86.

This is a simple C# example for PDF barcode reading. If you want to try more demo codes, please refer to the site RasterEdge.XImage.BarcodeScanner.

public static void ReadBarcodeFromPDF(string filename, int pageIndex)
      // generate PDF document
      PDFDocument doc = new PDFDocument(filename);

      // get the page you want to read barcode from
      BasePage page = doc.GetPage(pageIndex);

      // set reader setting
      ReaderSettings setting = new ReaderSettings();

      // read out barcode information
      Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, page);

      // output barcode information
      foreach (Barcode barcode in barcodes)