010-68421378
sales@cogitosoft.com
产品分类
AddFlow  AmCharts JavaScript Stock Chart AmCharts 4: Charts Aspose.Total for Java Altova SchemaAgent Altova DatabaseSpy Altova MobileTogether Altova UModel  Altova MapForce Altova StyleVision Server Altova MapForce Server Altova Authentic Aspose.Total for .NET Altova RaptorXML Server ComponentOne Ultimate Chart FX for SharePoint Chart FX CodeCharge Studio ComponentOne Enterprise combit Report Server Combit List & Label 22 Controls for Visual C++ MFC Chart Pro for Visual C ++ MFC DbVisualizer version 12.1 DemoCharge DXperience Subscription .NET DevExpress Universal Subscription Essential Studio for ASP.NET MVC FusionCharts Suite XT FusionCharts for Flex  FusionExport V2.0 GrapeCity TX Text Control .NET for WPF GrapeCity Spread Studio Highcharts Gantt Highcharts 10.0 版 HelpNDoc Infragistics Ultimate  ImageKit9 ActiveX ImageKit.NET JetBrains--Fleet JetBrains-DataSpell JetBrains--DataGrip jQuery EasyUI jChart FX Plus Nevron Vision for .NET OPC DA .NET Server Toolkit  OSS ASN.1/C Oxygen XML Author  OSS 4G NAS/C, C++ Encoder Decoder Library OSS ASN.1 Tools for C with 4G S1/X2 OSS ASN.1/C# OSS ASN.1/JAVA OSS ASN.1/C++ OPC HDA .NET Server Toolkit OPC DA .Net Client Development Component PowerBuilder redgate NET Developer Bundle Report Control for Visual C++ MFC  Altova StyleVision Sencha Test Stimulsoft Reports.PHP Stimulsoft Reports.JS Stimulsoft Reports.Java Stimulsoft Reports. Ultimate Stimulsoft Reports.Wpf Stimulsoft Reports.Silverlight SPC Control Chart Tools for .Net SlickEdit Source Insight Software Verify .Net Coverage Validator Toolkit Pro for VisualC++MFC TeeChart .NET Telerik DevCraft Complete Altova XMLSpy Zend Server

Dynamsoft Barcode Reader C/C ++ API for Mac

Dynamsoft Barcode Reader C/C ++ API for Mac

使用Dynamsoft Barcode Reader C/C ++ API for Mac

Dynamsoft Barcode Reader SDK为Mac提供C ++和C API。 您可以使用条形码API轻松创建Mac的条形码读取软件。在本文中,我将演示如何使用Mac的C ++条形码读取API在Mac OS上构建一维和二维条形码识别的命令行应用程序 X。

开始一个新文件

新建命令行工具

首先,让我们打开Xcode。

选择命令行工具作为项目模板,并在类型下选择C ++ stdc ++。 让我们将项目命名为BarcodeReaderDemo。

添加引用

在main.cpp中,请包括.H文件。

在我们的示例中,如果您在应用程序下安装了条形码阅读器,则路径将为“/ Applications / Dynamsoft / Barcode Reader 4.1 / Include / If_DBRP.h”。

#include

#include“/ Applications / Dynamsoft / Barcode Reader 4.1 / Include / If_DBRP.h”

复制主功能

接下来,插入下列代码到主功能

int  main  ( int  argc,   const  char *  argv[ ] )

{

   //Define variables

   const char * pszImageFile = "";

   int  iIndex = 0;

   int  iRet = -1;

       

   //Initialize license prior to any decoding

   CBarcodeReader reader;

   reader.InitLicense("");

 

   //Initialize ReaderOptions

   ReaderOptions ro = {0};   

   ro.llBarcodeFormat = OneD;      //Expected barcode types to read.

   ro.iMaxBarcodesNumPerPage = 100;      //Expected barcode numbers to read.

   reader.SetReaderOptions ( ro );

 

   //Start decoding

   iRet = reader.DecodeFile( pszImageFile );

   

   //If not DBR_OK

   if ( iRet != DBR_OK )

   {

           printf( "Failed to read barcode: %d\r\n%s\r\n",

          iRet,GetErrorString(iRet) );

           return iRet;

   }

 

   //If DBR_OK

   pBarcodeResultArray paryResult = NULL;

   reader.GetBarcodes(&paryResult);

   printf("%d total barcodes found. \r\n",paryResult->iBarcodeCount);

   for (iIndex = 0; iIndex < paryResult->iBarcodeCount; iIndex++)

   {

          printf("Result %d\r\n", iIndex + 1);

           printf("PageNum: %d\r\n", paryResult->

          ppBarcodes[iIndex]->iPageNum);

           printf("BarcodeFormat: %lld\r\n", paryResult->

          ppBarcodes[iIndex]->llFormat);

           printf("Text read: %s\r\n", paryResult->

          ppBarcodes[iIndex]->pBarcodeData);

   }

 

   //Finally release BarcodeResultArray

   CBarcodeReader::FreeBarcodeResults(&paryResult);

       

   return 0;

}

选择链接库

选择Targets - > BarcodeReaderDemo,单击信息按钮,在弹出的对话框中,addlibDynamsoftBarcodeReader.dylib依赖。

更新许可证和源映像

请在代码中分别使用有效值更新<您的映像文件完整路径>和<您的许可证密钥>。

对于图像路径,您可以在Images文件夹中使用AllSupportedBarcodeTypes.tif。

对于许可证密钥,请在BarcodeReaderTrialLic.txt中找到它。

const char * pszImageFile =“/ Applications / Dynamsoft / Barcode Reader 4.1 /

Images / AllSupportedBarcodeTypes.tif“;

                

现在你可以构建项目并运行。

条形码结果

请打开Terminal.app 并运行该app并确认是否可行

快速导航

                               

 京ICP备09015132号-996网络文化经营许可证京网文[2017]4225-497号 | 违法和不良信息举报电话:4006561155

                                   © Copyright 2000-2023 北京哲想软件有限公司版权所有 | 地址:北京市海淀区西三环北路50号豪柏大厦C2座11层1105室

                         北京哲想软件集团旗下网站:哲想软件 | 哲想动画

                            华滋生物