原創|其它|編輯:郝浩|2012-12-05 15:48:26.000|閱讀 481 次
概述:如何使用GdPicture.NET快速讀取PDF文檔中的1D和2D碼?本文將通過示例代碼為你詳細介紹。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
使用GdPicture.NET可以快速讀取PDF文檔中的1D和2D碼,下面給出示例代碼。
1 讀取PDF文檔中的1D碼
'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 讀取
PDF文檔中的Datamatrix碼
'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
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網