Hello,
Hi,
Thanks for considering Aspose.
Barcodes can be recognized from pdf documents using 2 components:
- Aspose.Pdf.Kit for .NET for extracting images from pdf document
- Aspose.BarCode for .NET for reading barcodes from images
I have also attached a sample application that recognizes a code39 (1D) barcode from a pdf document.
For recognizing 2D barcodes, you need to have a license file. Please visit http://www.aspose.com/corporate/purchase/temporary-license.aspx for getting a temporary license for 30 days.
Thanks for providing the sample. However, I am not able to get it to work, even after downloading the Temporary Licenses. Though I am not getting any errors, the barcode on PDF is not read.
I would really appreciate if you can provide some solution so that we can go ahead and finalize the purchase.
We are losing time.
Thanks for your understanding.
Below is the code I used
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Aspose.Pdf.Kit;
using System.IO;
using Aspose.BarCodeRecognition;
namespace BarCodeReadFromPdf
{
public partial class Form1 : System.Windows.Forms.Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
// set the license for Aspose.BarCode for .NET and Aspose.Pdf.Kit for .NET components
Aspose.BarCodeRecognition.License licenceBarCodeRecognition = new Aspose.BarCodeRecognition.License();
licenceBarCodeRecognition.SetLicense(@"c:\Aspose.BarCode.lic");
Aspose.Pdf.Kit.License licensePdfKit = new Aspose.Pdf.Kit.License();
licensePdfKit.SetLicense(@"c:\Aspose.Pdf.Kit.lic");
// bind the pdf document
PdfExtractor pdfExtractor = new PdfExtractor();
pdfExtractor.BindPdf(@"may12-1.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.Pdf417);
while(barcodeReader.Read())
{
Console.WriteLine("Codetext found: " + barcodeReader.GetCodeText() + ", Symbology: " + barcodeReader.GetReadType().ToString());
MessageBox.Show("Codetext found: " + barcodeReader.GetCodeText() + ", Symbology: " + barcodeReader.GetReadType().ToString());
}
// close the reader
barcodeReader.Close();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
Hi,
I tried to recognize the barcode from the attached pdf document. The BarCodeReader class could not recognize the barcode from the image. I have logged this bug in our issue tracking system (ID: 16752). We are working on this issue and let you know as soon as it is resolved. Sorry for the inconvenience.
HI,
I’d saved the extracted image on the pdf and found the embedded image doesn’t contain quite zones(blank areas) around the PDF417 barcode, please check your barcode generation routine.
Thanks
The issues you have found earlier (filed as BARCODENET-16752) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.