I'm trying to read the barcode of PDF documents. Most of them are read perfectly, but there's one particular barcode that doesn't seem to work. It has the following syntax: IR---QESH-V4. Every PDF with a barcode of that syntax fails to be read. Other barcodes look like this: IR---HPL-V4 or IR---V4 or... and they do work. I've also tried to read them with the barcode scanner sample application, same result. Can someone please figure out why that barcode fails? I've also tried functions like ConvertTo1Bpp and AutoDeskew. The image of the PDF is 300DPI.
The PDF file is attached.
Thank you very much.
Code: Select all
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click CloseCurrentImage() GdViewer1.ZoomMode = ViewerZoomMode.ZoomModeFitToViewer Dim openFileDialog As New OpenFileDialog() openFileDialog.InitialDirectory = "" openFileDialog.Filter = "PDF Files (*.pdf)|*.pdf" If openFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then Dim pdf As Integer = oGdPictureImaging.PdfReaderLoadFromFile(openFileDialog.FileName) For i As Integer = 1 To oGdPictureImaging.PdfReaderGetPageCount(pdf) If oGdPictureImaging.PdfReaderSelectPage(pdf, i) Then mImage = oGdPictureImaging.PdfReaderRenderPageToGdPictureImage(pdf, 300, False) oGdPictureImaging.ConvertTo1Bpp(mImage) oGdPictureImaging.AutoDeskew(mImage) ' Scan barcode oGdPictureImaging.Barcode1DReaderDoScan(mImage) ' If no barcode is found exit, else continue process Dim bcCount As Integer = oGdPictureImaging.Barcode1DReaderGetBarcodeCount Dim bcIndex As Integer = 1 If bcCount = 0 Then MsgBox("No barcode found!") Exit Sub ElseIf bcCount > 1 Then For j As Integer = 1 To bcCount If oGdPictureImaging.Barcode1DReaderGetBarcodeValue(i).Length >= 15 Then bcIndex = i End If Next tsName = oGdPictureImaging.Barcode1DReaderGetBarcodeValue(bcIndex) Else tsName = oGdPictureImaging.Barcode1DReaderGetBarcodeValue(1) End If GdViewer1.DisplayFromGdPictureImage(mImage) ShowImageInfo() mImage = Nothing End If Next End If End Sub