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

C# & VB.NET Guide: Read PDF-417

back to home  >  .NET Barcode Reader SDK  >  Recognize Barcodes in .NET  >  C# and VB.NET Guide for PDF-417 Decoding

In the download package of our barcode scanner software for .NET, you may find a DLL library called PQScan.BarcodeScanner.dll. This .NET assembly can be used in C# and VB.NET PDF-417 barcode recognition applications. To use this software in your .NET windows or web project, Visual Studio 2005+ and .NET Framework 2.0+ should be installed on your computer.

Using this .NET barcode reader component for PDF-417, various 2D barcode decoding features can be implemented in your Visual C# and Visual Basic .NET projects. For instance, you can easily read PDF-417 2D barcode from Jpeg, Jpg, Png, Gif, Bmp, Tiff, and Tif image files; you can also recognize PDF-417 from PDF document. Moreover, you are able to customize the way of barcode recognition, scanning only PDF417 bar code or all barcode types from loaded image source.

The following two parts will respectively illustrate how to scan and decode PDF417 barcode from image file using free C# sample code and VB.NET sample code, no matter wherever the barcode position in the image.

C# Sample: Scan PDF-417 from Image

The following free Visual C# sample code only depicts how to scan PDF-417 barcode symbol from an image file on your local disk. You may also find related APIs for reading PDF-417 from a bitmap or stream of image source. In this C# coding example, PDF417 is defined as the target barcode type so that only this barcode type will be decoded from your image file.

public void ScanPDF417FromFile(string filename)
  // Set PDF417 as the target barcode symbol and decode them all from an image file.
  BarcodeResult[] results = BarCodeScanner.Scan(filename, BarCodeType.PDF417);

  // APIs for reading PDF417 from Bitmap and Stream of image.
  // public static BarcodeResult[] Scan(Bitmap bitmap, BarCodeType barType);
  // public static BarcodeResult[] Scan(Stream stream, BarCodeType barType);

  foreach (BarcodeResult result in results)
    Console.WriteLine(result.BarType.ToString() + "-" + result.Data);

If there's only one PDF-417 barcode on your image. You can use the following C# code to read PDF-417 barcode from image. This will help to improve barcode reader accuracy.

// Use this way to read barcode when there's only one barcode on image.
Bitmap bmp = new Bitmap("YourImagePath");
BarcodeResult barcode = BarCodeScanner.ScanSingle(bmp);
Console.WriteLine("barcode data:{0}.", barcode.Data);

VB.NET Sample: Scan PDF-417 from Image

With the help of .NET Barcode Reader Component, VB.NET users are empowered to read all barcode types including PDF-417 font from loaded image file. And the scanning result will be the form of data array, including barcode type and barcode text data information. The following VB.NET sample code can be copied to implement this function at fast speed.

Public Sub ScanAllFromFile(ByVal filename As String)
  ' VB.NET sample code for reading all barcode symbols from an image file.
  Dim results() As BarcodeResult = BarCodeScanner.Scan(filename)

  ' VB.NET APIs for scanning all barcode types from Bitmap and Stream of image.
  ' public static BarcodeResult[] Scan(Bitmap bitmap)
  ' public static BarcodeResult[] Scan(Stream stream)

  Dim result As BarcodeResult
  For Each result In results
    Console.WriteLine(result.BarType.ToString() + "-" + result.Data)
End Sub

Please note, you can use the following VB.NET demo code to improve barcode reader accuracy when there's only one PDF-417 on your image.

Dim bmp As Bitmap = New Bitmap("YourImagePath") 
Dim barcode As BarcodeResult = BarCodeScanner.ScanSingle(bmp) 
Console.WriteLine("barcode data:{0}.", barcode.Data)

Please note that, if you want to recognize PDF417 bar code from PDF file, you should firstly use our .NET PDF to Image Converter Library to convert PDF to image file, and then use .NET Barcode Decoder Library to decode barcodes from rendered image file.

pqScan SDK
.NET Barcode Decoder SDK
Online Guide
.NET Barcode Recognition Guide C# Barcode Recognition Guide VB Barcode Recognition Guide
Barcode Type
C#/VB Reading Code for QR Code C#/VB Reading Code for Data Matrix C#/VB Reading Code for Aztec Code C#/VB Reading Code for Code 128 C#/VB Reading Code for Code 39 C#/VB Reading Code for EAN-13 C#/VB Reading Code for EAN-8 C#/VB Reading Code for UPC-A C#/VB Reading Code for UPC-E C#/VB Reading Code for Code 93 C#/VB Reading Code for Codabar C#/VB Reading Code for ITF-14 View All Barcodes >>
The best barcode reading performance toolkit and quality, according to my testing experience with other alternatives. Definitely great product with reasonable price. Jonny Ortman