Free Support Forum - aspose.com

Cannot read Barcode from PDF

I am not able to read the barcode (Code39Standard) in the attached PDF. We have no control over the PDFs we receive or the barcodes included.

Using other products I am able to read the barcode. Using the PdfExtractor code that I have seen in a few other posts to this forum.

Hi Mike,


Thank you for contacting support. I’ve tested your sample PDF document against the latest builds of Aspose.BarCode 6.1.0 and Aspose.Pdf 9.1.0. There are two Code39 barcodes. We can recognize the one of them. Please see a sample code and results as follows:

[C#]

int pageIndex = 0;<o:p></o:p>

// bind the pdf

PdfConverter converter = new PdfConverter();

converter.BindPdf(@"C:\temp\COMP0002.pdf");

converter.RenderingOptions.BarcodeOptimization = true;

converter.DoConvert();

while (converter.HasNextImage())

{

pageIndex++;

Console.WriteLine("Getting next Page...");

MemoryStream pageStream = new MemoryStream();

converter.GetNextImage(pageStream, ImageFormat.Png);

using (BarCodeReader reader = new BarCodeReader(pageStream, BarCodeReadType.Code39Extended))

{

while (reader.Read())

{

Console.WriteLine("Page#" + pageIndex + " Code Text: " + reader.GetCodeText() + " Type: " + reader.GetReadType());

}

}

}


Results:
Getting next Page...
Page#1 Code Text: BA2100595aR0002 +09012010+08062010 Type: Code39Extended

For the sake of correction, I've logged an issue under ticket id BARCODENET-33887 in our issue tracking system. Your request has also been linked to this issue. We'll let you know once a significant progress has been made in this regard. We're sorry for your inconvenience.

Thank You. Using your updates I am seeing the same barcode that you did.

Hi Mike,


Thank you for the confirmation. We’ll keep you informed of any progress about issue id BARCODENET-33887 and let you know in this forum thread.

If you would like a few more samples I can provide them. Both Code39 and Code128.

Hi Mike,


Sure, it is recommended to share all problematic barcode images in this forum thread. We’ll take a closer look and guide you accordingly.

Attached are 2 zip files

Code39Extended contains

COMP0007.pdf

Aspose.Barcode found

Barcode found: BA2479046wI0050 +03202013+03202013 - on page 2
Barcode found: BA2479046wA0007CA +03202013+03202013 - on page 3

What should have been found is

Barcode found: BA2479046 - on page 1
Barcode found: BA2479046+AR0002 +04202013+03202013 - on page 1
Barcode found: BA2479046+WI0050 +03202013+03202013 - on page 2
Barcode found: BA2479046+WA0007CA +03202013+03202013 - on page 3

COMP0008.pdf what should have been found

Barcode found: BA2479354 - on page 1
Barcode found: BA2479354+AR0005C +08082012+03202013 - on page 1

The second zip file Code128 uses Code128

What should have been found is:

COMP0003.pdf - BA0687436^ENBATCH ^EN^ENDT #002 E00 05/08/12^
COMP0004.pdf - BA0687731^ENBATCH ^EN^ENDT #007 E00 04/01/12^
COMP0005.pdf - BA0687766^ENBATCH ^EN^ENDT #004 E00 05/10/12^

Hi Mike,


Thank you for sharing problematic documents. Please accept our apologies for the delay. We are working over your query and shall get back to you soon.

Hi Mike,


Thank you for being patient. We’ve tested your sample PDF documents against the latest builds of Aspose.BarCode 6.1.0 and Aspose.Pdf 9.1.0. I managed to replicate the problems of recognition failure. As a workaround, you need to set the resolution to 300 before converting the PDF page to an image. Please take a look over this sample source code:

string[] files = Directory.GetFiles(@“C:\temp”);<o:p></o:p>

foreach (string file in files)

{

int pageIndex = 0;

// bind the pdf

PdfConverter converter = new PdfConverter();

converter.BindPdf(file);

converter.RenderingOptions.BarcodeOptimization = true;

converter.Resolution = new Aspose.Pdf.Devices.Resolution(300);

converter.DoConvert();

while (converter.HasNextImage())

{

pageIndex++;

MemoryStream pageStream = new MemoryStream();

converter.GetNextImage(pageStream, ImageFormat.Png);

using (BarCodeReader reader = new BarCodeReader(pageStream, BarCodeReadType.Code39Extended))

{

while (reader.Read())

{

Console.WriteLine("File Name: " + Path.GetFileName(file) + " Page#" + pageIndex + " Code Text: " + reader.GetCodeText() + " Type: " + reader.GetReadType());

}

}

}

}


Results:
File Name: COMP0007.PDF Page#1 Code Text: BA2479046aR0002 +04202013+0320201
3 Type: Code39Extended
File Name: COMP0007.PDF Page#1 Code Text: BA2479046 Type: Code39Extended
File Name: COMP0007.PDF Page#2 Code Text: BA2479046wI0050 +03202013+0320201
3 Type: Code39Extended
File Name: COMP0007.PDF Page#3 Code Text: BA2479046wA0007CA +03202013+0320201
3 Type: Code39Extended
File Name: COMP0008.PDF Page#1 Code Text: BA2479354aR0005C +08082012+0320201
3 Type: Code39Extended
File Name: COMP0008.PDF Page#1 Code Text: BA2479354 Type: Code39Extended

For the sake of correction, we have logged these issues as follows:

File Name: COMP0003.pdf
BARCODENET-33889 - Can’t recognize Code128 barcode from the PDF document

File Name: COMP0004.pdf
BARCODENET-33890 - Can’t recognize Code128 barcode from the PDF document

File Name: COMP0005.pdf
BARCODENET-33891 - Can’t recognize Code128 barcode from the PDF document

File Name: COMP0007.pdf
BARCODENET-33892 - Can’t recognize Code39 barcodes from the PDF document

File Name: COMP0008.pdf
BARCODENET-33893 - Can’t recognize Code39 barcodes from the PDF document

Your request has also been linked to these issues. We’ll let you know once a significant progress has been made in this regard. We’re sorry for your inconvenience.

Another problem being that you are still returning a lower case alpha where a '+' in the 2 samples for Code39Extended PDFs, COMP0007.pdf and COMP0008.pdf.

BA2479046aR0002 should be BA2479046+R0002

Did not list the entire text since the rest of the text found is correct.

Hi Mike,


Thank you for the details. It looks not an issue to me as I can get the same code text by using other online barcode readers. Anyway, I’ve logged two investigations in our issue tracking system as follows:

File Name: COMP0007.pdf
BARCODENET-33895 - Incorrect recognition of the Code39 from PDF file
Incorrect code text: "BA2479046aR0002 +04202013+03202013"
Correct code text: "BA2479046+R0002 +04202013+03202013"

File Name: COMP0008.pdf
BARCODENET-33896 - Incorrect recognition of the Code39 from PDF file
Incorrect code text: "BA2479354aR0005C +08082012+03202013"
Correct code text: "BA2479354+R0005C +08082012+03202013"

Your request has also been linked to these issues. We’ll let you know once a significant progress has been made in this regard. We’re sorry for your inconvenience.

I need to correct what the barcodes should contain in my last reply.

COMP0007.pdf - BA2479046+AR0002 +04202013+03202013

COMP0008.pdf - BA2479354+AR0005C +08082012+03202013
I am using barcode readers from Atalasoft and Clear Image, but I am not having to use CODE39 Extended to read the barcodes. So +A for my testing represents '+' and 'A' not a lower case 'a'. The problem becomes that I must be able to read these barcodes as Code39Standard not Code39Extended. I should have recognized this in my 4/25 reply.

Hi Mike,

Thank you for sharing code text values. I have passed this information to our development team against the ticket ids BARCODENET-33895 and BARCODENET-33896. As soon as we have made some significant progress, we would be more than happy to update you with the status of correction.
Mike.Oakley:

I should have recognized this in my 4/25 reply.

I'm sorry to share with you that I could not get your point there.

[quote user="imran.refique"]I'm sorry to share with you that I could not get your point there.[/quote]

This sample that I provided on 4/25 clearly shows the problem associated with reading barcodes with Code39Extended instead of Code39Standard.

COMP0007.pdf

Aspose.Barcode found

Barcode found: BA2479046wI0050 +03202013+03202013 - on page 2
Barcode found: BA2479046wA0007CA +03202013+03202013 - on page 3

What should have been found is

Barcode found: BA2479046+WI0050 +03202013+03202013 - on page 2
Barcode found: BA2479046+WA0007CA +03202013+03202013 - on page 3

Hi Mike,


Thank you for the clarification. I have passed this information to our development team against the ticket id BARCODENET-33895. Please be patient and spare us a little time to complete the analysis.

Hi Mike,

Thank you for being patient. We have a good news for you is BARCODENET-33895 and BARCODENET-33896 have now been marked as resolved. If there is no issue in the QA phase, then their fixes fix will be included in the next version of Aspose.BarCode for .NET 6.3.0. It is expected at the start of next month. We will inform you via this forum thread as soon as the new release is published.

I understand that this has been fixed. We are seriously considering buying Aspose.Net is there any chance we can of an early look at this fix for our own verification. This is the one issue that may prevent us from purchasing.

Hi Mike,


Thank you for your inquiry. Our development team is working hard to deliver the new release of Aspose.BarCode 6.3.0. We’re expecting that it will be released in a couple of weeks. However, I have added my comments to share the exact release date. As soon as any information is available, I will be more than happy to share that with you.

Hi Mike,


Thank you for being patient. I’ve received a response from our development team. Aspose.BarCode for .NET 6.3.0 release is expected at the end of the current week or earlier in the next week. We’ll let you know once it is published.

The issues you have found earlier (filed as BARCODENET-33895,BARCODENET-33896) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.