GdPicture如何快速从PDF文件中识别QR条形码

作者:控件中国网   出处:控件中国网   2016-07-26 14:35:16   阅读:5

GdPicture不仅可以对多种图片、图像文档进行各种处理,还可以结合控件提供的添加模块实现多种其他功能,条码生成和识别是控件提供的一个可添加模块,开发人员通过该模块可以实现一维和二维条形码的生成与识别,下面的代码讲述了如何快速从PDF文档中识别OR条形码:
GdPicturePDF oGdPicturePDF = new GdPicturePDF();
if (oGdPicturePDF.LoadFromFile("input.pdf", false) == GdPictureStatus.OK) {
   //Step2: Convert the desired PDF page to GdPicture Image
   oGdPicturePDF.SelectPage(1);
   int imageID = oGdPicturePDF.RenderPageToGdPictureImage(200, false);
   if (imageID != 0) {
      //Step3: Barcode recognition from GdPicture Image
      GdPictureImaging oGdPictureImaging = new GdPictureImaging();
      oGdPictureImaging.BarcodeQRReaderDoScan(imageID, BarcodeQRReaderScanMode.BestQuality);
      oGdPictureImaging.ReleaseGdPictureImage(imageID);
      for (int i = 1; i <= oGdPictureImaging.BarcodeQRReaderGetBarcodeCount(); i++) {
         MessageBox.Show("Barcode no: " + i.ToString() + Strings.Chr(13) + 
            "Barcode version: " + oGdPictureImaging.BarcodeQRReaderGetVersion(i).ToString + Strings.Chr(13) + 
            "Barcode value: " + oGdPictureImaging.BarcodeQRReaderGetBarcodeValue(i));
      }
      oGdPictureImaging.BarcodeQRReaderClear();
   }
   oGdPicturePDF.CloseDocument();
}
Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat