Hi, can anyone help me? I have some barcode in PDF document, and I'd like to decode these barcodes out. Does your .net barcode reader support this?
---- Johnson
Hi, can anyone help me? I have some barcode in PDF document, and I'd like to decode these barcodes out. Does your .net barcode reader support this?
---- Johnson
Hi, Johnson.
Our .NET Barcode Scanner is only able to read barcode from images, such as .bmp, .png and so on. If you want to read barcode from PDF, you can use our PDF to Image Library to translate PDF page to image first, and then decode the barcode from image.
Here we provide steps of reading barcode from PDF using .NET Barcode Scanner SDK and .NET PDF to Image SDK.
using System; using System.Drawing; using PQScan.PDFToImage; using PQScan.BarcodeScanner; namespace BarcodeReaderQuestion { class Program { static void Main(string[] args) { //step 1: //convert PDF to image. PDFDocument pdf = new PDFDocument(); pdf.LoadPDF("sample.pdf"); //get first page to image Bitmap bmp = pdf.ToImage(0); //step 2: //scan barcode from image BarcodeResult[] results = BarCodeScanner.Scan(bmp); foreach (BarcodeResult result in results) { Console.WriteLine("barcode data:" + result.Data); Console.Write(" barcode type:" + result.BarType.ToString()); } } } }
Hope the C# code can be helpful.
---- pqScan Support Team
Copyright © pqScan 2010-2023. All Rights Reserved.