QR Code Image Sample - pqScan.com
.NET Barcode Scanner SDK Building up Perfect Quality Barcode Reading Software for .NET Online Demo Download Trial Purchase Now
C#.NET
VB.NET

How to Read Barcode from PDF in C#.NET?

back to home  >  .NET Barcode Scanner SDK  >  Read Barcodes in .NET  >  C# Barcode Scanning from PDF

As you know, pqScan .NET Barcode Reader Library can be used to scan and recognize 1D and 2D barcodes from common image file formats (like PNG, JPEG, TIFF, GIF, BMP). However, there are also a lot of needs for decoding barcode information from PDF file in Visual C#.NET project. So, we provide a solution for this. To achieve fast C# barcode recognition from PDF document, both our .NET Barcode Reader SDK and .NET PDF to Image Conversion SDK should be used. For more information, you can see pqScan PDF to Image Converter in .NET.

These two SDKs support reading 10+ barcode types from PDF file using C# programming language, like linear barcodes (Code128, UPC-A, UPC-E, EAN8, EAN13, etc.) and matrix barcodes (QRCode, PDF417, DataMatrix, etc.).

Scan Barcode in PDF - C Sharp Sample

Now, taking linear bar code as an example, we will introduce you how to detect and decode Code 128 barcode image from PDF document page in C#.NET application. First, launch Visual Studio and create a new Console Application. Then, download pqScan .NET PDF to Image SDK and .NET Barcode Reader SDK, and add "PQScan.PDFToImage.dll" and "PQScan.BarcodeScanner.Linear.dll" to your C# project reference. Finally, copy and paste the following free C# code into your project.

using System.Drawing;
using PQScan.PDFToImage;
using PQScan.BarcodeScanner.Linear;

namespace ScanBarcodeInPDF
{
  Class Program
  {
    static void Main(string[] args)
    {
      // Create an instance of PQScan.PDFToImage.PDFDocument object.
      PDFDocument pdfDoc = new PDFDocument();

      // Load a PDF document.
      pdfDoc.LoadPDF("sample.pdf");

      // Get the first page of PDF and convert it to image.
      Bitmap bmp = pdfDoc.ToImage(0);

      // Read all Code 128 bar code information.
      BarcodeResult[] barcodeResults = BarCodeScanner.Scan(bmp,BarCodeType.Code128);

      foreach (BarcodeResult barcodeInfo in barcodeResults)
      {
        Console.WriteLine(barcodeInfo.Data);
      }
    }
  }
}
pqScan SDK
.NET Barcode Scanner Library .NET PDF to Image Library
Online Guide
.NET Barcode Reading .NET PDF to Image Conversion
Barcode Type
Read QR Code in .NET Read Data Matrix in .NET Read PDF-417 in .NET Read Aztec Code in .NET Read EAN-13 in .NET Read EAN-8 in .NET Read UPC-A in .NET Read UPC-E in .NET Read Code 128 in .NET Read Code 39 in .NET Read Code 93 in .NET Read Codabar in .NET Read ITF-14 in .NET
I'm an amateur developer. With the help of your SDKs, my application is more perfect now. I'm proud of my application. It is my biggest win. Thank you for great help. Nelson Hall