彩票走势图

GdPicture.NET使用教程:读取PDF中的1D和2D条码

原创|其它|编辑:郝浩|2012-12-05 15:48:26.000|阅读 429 次

概述:如何使用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@pclwef.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP