Spire.Barcode is a professional barcode library specially designed for .NET developers (C#, VB.NET, ASP.NET, .NET Core) and Java developers (J2SE and J2EE) to generate, read and scan 1D & 2D barcodes.

Tue May 27, 2014 4:39 pm

Hi there,
i wanted to try the barcode reader - but can't get it to do anything. I tried scan(image), scan(file path), with barcode types, without types, scan(), scanone(), everything... :-(
I downloaded the newest setup and the hot fix.
Please find attached a screenshot of the code and error message plus a sample PDF. Can you help me?
Thanks a lot, Oliver

krauseolli
 
Posts: 4
Joined: Tue May 27, 2014 11:57 am

Wed May 28, 2014 3:50 am

Hello,

Our Spire.Barcode can scan images. But it can’t scan files directly such as doc, pdf and excel. You will have to extract barcode images from files first and use Spire.Barcode to scan these image files. You can use the free version of our other products to extract images.
Or you can provide us more sample images and files. We will test these files using Spire.Barcode and we can provide you customized demo if you need it.
If you get any questions when evaluating Spire.Barcoe, welcome to tell us.

Thanks and Regards,
Benjamin
E-iceblue support team
User avatar

Benjamin Du
 
Posts: 82
Joined: Thu Jul 25, 2013 2:38 am

Wed May 28, 2014 7:37 am

OK - I'll try again. Thanks!

krauseolli
 
Posts: 4
Joined: Tue May 27, 2014 11:57 am

Wed May 28, 2014 7:50 am

Sorry, but it still does not work :-( I am converting the PDF to bitmap via spire.pdf and then try to read from the bmp-object. The bitmap looks fine if I take a peak via "bmp.save("temp.bmp") ". Here is my code... Any ideas what could be wrong? Thanks a lot, Oliver

''' <summary>
''' Prüft, ob die Datei Barcodes enthält und gibt sie aus
''' </summary>
''' <param name="dateiname"></param>
''' <remarks></remarks>
Public Shared Function PrüfeBarcodeSpire(ByVal dateiname As String) As String

Dim result As String = "Lesevorgang fehlerhaft"

'-- Read PDF into byte array
Dim bData As Byte()
Dim br As IO.BinaryReader = New IO.BinaryReader(System.IO.File.OpenRead(dateiname))
bData = br.ReadBytes(br.BaseStream.Length)
br.Close()
br.Dispose()

'-- empty list for images
Dim images As New List(Of System.Drawing.Bitmap)

'-- open pdf from byte array
Dim pdf As New Spire.Pdf.PdfDocument
pdf.LoadFromBytes(bData)

If pdf.Pages.Count = 0 Then
pdf.Close()
pdf.Dispose()
result = "Datei enthält keine Seiten"
Return result
End If

Dim anzahlPages As Integer = pdf.Pages.Count

'-- convert pdf to bitmap
For i As Integer = 0 To anzahlPages - 1
images.Add(pdf.SaveAsImage(i, Spire.Pdf.Graphics.PdfImageType.Bitmap, 600, 600))
Next

pdf.Close()
pdf.Dispose()

Dim barcodes(0) As String
Dim scan As String = String.Empty

'-- scan bitmap for barcodes
For Each bild As System.Drawing.Bitmap In images
scan = Spire.Barcode.BarcodeScanner.ScanOne(bild)

If Not String.IsNullOrEmpty(scan) Then
barcodes(0) = scan

Dim gl7code As Etikett.Barcode = FindeGL7Barcode(barcodes)
If gl7code IsNot Nothing Then
result = "GL7-Code: " & gl7code.ScanWert
Else
result = "Kein gültiger GL7-Code gefunden"
End If
Else
result = "1. Seite enthält keinen Barcode"
End If
Next

Return result

End Function

krauseolli
 
Posts: 4
Joined: Tue May 27, 2014 11:57 am

Wed May 28, 2014 8:50 am

Hello,

The type of barcode that is supported by Spire.Barcode in defined in enum BarCodeType. Please make sure the barcode in your sample pdf file is supported. Or you can provide us with more sample files. And our support team will test these files for you.
If you get any questions, welcome to tell us.

Thanks and Regards,
Benjamin
E-iceblue support team
User avatar

Benjamin Du
 
Posts: 82
Joined: Thu Jul 25, 2013 2:38 am

Wed May 28, 2014 9:12 am

Thanks for the quick reply, but: I already get the Error "parameter is not valid" in this line long before any barcode formats might be evaluated...
scan = Spire.Barcode.BarcodeScanner.ScanOne(bild)
(see Screenshot).

krauseolli
 
Posts: 4
Joined: Tue May 27, 2014 11:57 am

Thu May 29, 2014 2:14 am

Hello,

I used your code to do a test and didn’t reproduce the issue that you encountered. Could you please provide us your project and all related files that can reproduce the error. This will help us to solve your issue more quickly.
If you have any questions, welcome to get it back to us.

Thanks and Regards,
Benjamin
E-iceblue support team
User avatar

Benjamin Du
 
Posts: 82
Joined: Thu Jul 25, 2013 2:38 am

Return to Spire.BarCode