You can use gdpicture. Net (click to enter the download page) to quickly read The 1D and 2D codes in the PDF document. The following shows the sample code.
1. Read the 1D code in the PDF document.
'Step1: Open the PDF Dim oGdPicturePDF As New GdPicture.GdPicturePDF If oGdPicturePDF.LoadFromFile("c:\test.pdf", False) = GdPictureStatus.OK Then 'Step2: Convert the desired PDF page to GdPicture Image oGdPicturePDF.SelectPage(1) Dim ImageID As Integer = oGdPicturePDF.RenderPageToGdPictureImage(200, False) If ImageID <> 0 Then 'Step3: Barcode recognition from GdPicture Image Dim oGdPictureImaging As New GdPicture.GdPictureImaging oGdPictureImaging.Barcode1DReaderDoScan(ImageID, Barcode1DReaderScanMode.BestQuality) oGdPictureImaging.ReleaseGdPictureImage(ImageID) For i As Integer = 1 To oGdPictureImaging.Barcode1DReaderGetBarcodeCount MsgBox("Barcode no: " + Str(i) + Chr(13) + _ "Barcode type: " + oGdPictureImaging.Barcode1DReaderGetBarcodeType(i).ToString + Chr(13) + _ "Barcode angle: " + Str(oGdPictureImaging.Barcode1DReaderGetBarcodeSkewAngle(i)) + Chr(13) + _ "Barcode value: " + oGdPictureImaging.Barcode1DReaderGetBarcodeValue(i)) Next oGdPictureImaging.Barcode1DReaderClear() oGdPictureImaging.Dispose() End If oGdPicturePDF.CloseDocument() End If
2 read
Datamatrix code in PDF document
'Step1: Open the PDF Dim oGdPicturePDF As New GdPicture.GdPicturePDF If oGdPicturePDF.LoadFromFile("c:\test.pdf", False) = GdPictureStatus.OK Then 'Step2: Convert the desired PDF page to GdPicture Image oGdPicturePDF.SelectPage(1) Dim ImageID As Integer = oGdPicturePDF.RenderPageToGdPictureImage(200, False) If ImageID <> 0 Then 'Step3: Barcode recognition from GdPicture Image Dim oGdPictureImaging As New GdPicture.GdPictureImaging oGdPictureImaging.BarcodeDataMatrixReaderDoScan(ImageID, BarcodeDataMatrixReaderScanMode.BestQuality) oGdPictureImaging.ReleaseGdPictureImage(ImageID) For i As Integer = 1 To oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeCount MsgBox("Barcode no: " + Str(i) + Chr(13) + _ "Barcode columns: " + oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeColumns(i).ToString + Chr(13) + _ "Barcode rows: " + Str(oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeRows(i)) + Chr(13) + _ "Barcode value: " + oGdPictureImaging.BarcodeDataMatrixReaderGetBarcodeValue(i)) Next oGdPictureImaging.BarcodeDataMatrixReaderClear() oGdPictureImaging.Dispose() End If oGdPicturePDF.CloseDocument() End If