Gdpicture. Net Tutorial: Read 1D and 2D codes in the PDF document

Source: Internet
Author: User

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 readDatamatrix 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.