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); } } } }