Detect & Read Barcodes from PDF
Detect & Read Barcodes from PDF
Hello,
Does your Barcode recognition work with pdf documents?
Best regards,
Christoph
Does your Barcode recognition work with pdf documents?
Best regards,
Christoph
Re: Barcode and PDF
Yes it does. here is a sample:
Let me know if you need more information.
Kind regards,
Loïc
Code: Select all
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oGdViewer As New GdPicture.GdViewer
Dim oGdPictureImaging As New GdPicture.GdPictureImaging
oGdViewer.SetLicenseNumber("XXX") 'Replace XXX by a valid license KEY
oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by a valid license KEY
oGdPictureImaging.SetLicenseNumber1DBarcodeRecognition("XXX") 'Replace XXX by a valid license KEY
oGdViewer.DisplayFromFile("") 'Prompt the user to select a PDF
If oGdViewer.GetDocumentType = DocumentType.DocumentTypePDF Then
Dim RasterPage As Integer = oGdViewer.PdfRenderPageToGdPictureImage(200, 1)
oGdPictureImaging.ConvertTo1Bpp(RasterPage) 'We should have better accuracy in 1bpp mode
oGdPictureImaging.Barcode1DReaderDoScan(RasterPage, Barcode1DReaderScanMode.BestQuality)
Dim BarcodeCount As Integer = oGdPictureImaging.Barcode1DReaderGetBarcodeCount
If BarcodeCount > 0 Then
For i As Integer = 1 To BarcodeCount
MsgBox("Barcode No: " & Str(i))
MsgBox("Type: " & oGdPictureImaging.Barcode1DReaderGetBarcodeType(i).ToString)
MsgBox("Value: " & oGdPictureImaging.Barcode1DReaderGetBarcodeValue(i))
MsgBox("Angle: " & Str(oGdPictureImaging.Barcode1DReaderGetBarcodeSkewAngle(i)))
Next
Else
MsgBox("No Barcode Detected !")
End If
oGdPictureImaging.Barcode1DReaderClear()
oGdPictureImaging.ReleaseGdPictureImage(RasterPage)
Else
MsgBox("Not A PDF")
End If
oGdViewer.CloseDocument()
End Sub
Kind regards,
Loïc
Re: Detect & Read Barcodes from PDF
Thank you. Yes there is another question. If i want to use it without the viewer. What do i have to change? I dont find a function to open the pdf document.
Best regards
Best regards
Re: Detect & Read Barcodes from PDF
The PDF rasterization is currently only available into the GdViewer class.
But it is not a problem since you can instantiate a GdViewer silently.
Kind regards,
Loïc
But it is not a problem since you can instantiate a GdViewer silently.
Kind regards,
Loïc
Re: Detect & Read Barcodes from PDF
Ok Hopefully this is the last question.
How do i set the next page on the rendered Tif/pdf image?
How do i set the next page on the rendered Tif/pdf image?
Re: Detect & Read Barcodes from PDF
Hum... I am not sure to understand your issue.
Here:
1 is the page number. Of course, you can change it.
Loïc
Here:
Code: Select all
PdfRenderPageToGdPictureImage(200, 1)
Loïc
Who is online
Users browsing this forum: No registered users and 1 guest