Screenshot Preview

Aspose.BarCode for .NET - Support

by Aspose - Product Type: Component / ASP.NET WebForms / .NET WinForms / .NET WPF / Silverlight / .NET Compact Framework / Windows Runtime Controls

Support Forum

Aspose.BarCode adnan_raf [USA] 24-Aug-2007 10:24:44

Can i read barcode from pdffile using the .net managed component? if yes then point be to some url and if no then what i need to do...?

Many thanks, adnan
Reply

RE: Aspose.BarCode shahzad.latif [Pakistan] 09-May-2012 19:23:32

Hi Adnan,

In order to read bar code from PDF file, you'll have to use two components: Aspose.Pdf (to extract bar code image from PDF), Aspose.Barcode (to read barcode from barcode image). You can use the following code to achieve your goal:

try
{
// set the license for Aspose.BarCode for .NET and Aspose.Pdf for .NET components
Aspose.BarCodeRecognition.License licenceBarCodeRecognition = new Aspose.BarCodeRecognition.License();
licenceBarCodeRecognition.SetLicense(@"Aspose.Total.lic");

Aspose.Pdf.License licensePdf = new Aspose.Pdf.License();
licensePdf.SetLicense(@"Aspose.Total.lic");

// bind the pdf document
PdfExtractor pdfExtractor = new PdfExtractor();
pdfExtractor.BindPdf(@"document.pdf");
// set page range for image extraction
pdfExtractor.StartPage = 1;
pdfExtractor.EndPage = 1;
// extract the images
Console.WriteLine("Extracting images.....");
pdfExtractor.ExtractImage();
// save images to stream in a loop
while (pdfExtractor.HasNextImage())
{
Console.WriteLine("Getting next image....");
// save image to stream
MemoryStream imageStream = new MemoryStream();
pdfExtractor.GetNextImage(imageStream);
imageStream.Position = 0;

Console.WriteLine("Recognizing barcode....");
// recognize the barcode from the image stream above
BarCodeReader barcodeReader = new BarCodeReader(imageStream, BarCodeReadType.Code39Standard);
while(barcodeReader.Read())
{
Console.WriteLine("Codetext found: " + barcodeReader.GetCodeText() + ", Symbology: " + barcodeReader.GetReadType().ToString());
}
// close the reader
barcodeReader.Close();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

If you need any further help, please do let us know.
Reply


Product Search

Enter search words:

The Software Superstore for IT Professionals

As Official Distributors, ComponentSource offers convenient, one-stop shopping from 250+ Software Publishers specializing in Application Development & Operations.

More Info | About Us

Screenshot Gallery

Click for full screen preview

Screenshot of Aspose.BarCode - .NET - V5.9.0 Screenshot of Aspose.BarCode - .NET - V5.9.0 Screenshot of Aspose.BarCode - .NET - V5.9.0 Screenshot of Aspose.BarCode - .NET - V5.9.0 Screenshot of Aspose.BarCode - .NET - V5.9.0
Award