C++
step 1 install clearimage sdk download and install the clearimage sdk https //barcode reader inliteresearch com/get cisdk step 2 configure your project use visual studio c++ clearimage example project https //barcode reader inliteresearch com/get ci example cpp or follow the instruction below when using the example project, copy \<font color="#eb144c">clearimage dll\</font> in the executable folder or in the path in your visual studio c++ project include a copy of \<font color="#eb144c">c \program files (x86)\inlite\clearimagesdk\clearimage wrapper hpp\</font> in every source file that uses clearimage api add a copy of \<font color="#eb144c">c \program files (x86)\inlite\clearimagesdk\clearimage lib\</font> to your project's \<font color="#eb144c">properties \>linker \>input \>additional dependencies\</font> entry place \<font color="#eb144c">clearimage dll\</font> in a location where it can be found according to microsoft's dll search order https //learn microsoft com/en us/windows/win32/dlls/dynamic link library search order rules typically it is a working folder where your application started from the \<font color="#eb144c">clearimage dll\</font> is installed in 32 bit version from \<font color="#eb144c">c \program files (x86)\inlite\clearimagesdk\win32\clearimage dll\</font> 64 bit version from \<font color="#eb144c">c \program files (x86)\inlite\clearimagesdk\x64\clearimage dll\</font> this code demonstrates the use of clearimage dll api runtime errors are reported in \<font color="#eb144c">exceptionci\</font> object \#include "clearimage wrapper hpp" void main() { try { 	 ciserver server = createciserver(); 	 // your clearimage api based code 	 } 	catch (exceptionci ex) { 	 std wcout << l"error " << ex getmessage() << std endl; 	} 	catch (std runtime error ex) { 	 std wcout << "error " << ex what() << std endl; 	} 	catch ( ) { 	 std wcout << "error " << "unknown"<< std endl; 	}	 } clearimage project development extend functionality while developing your application, you can combine code examples on this page with methods described in clearimage api documentation http //www inliteresearch com/help/ci dll api, as exposed through \<font color="#eb144c">clearimage wrapper hpp\</font> , is substantially similar to com api and net api \<font color="#eb144c">inlite clearimage\</font> namespace exception handling clearimage dll api reports errors as an \<font color="#eb144c">exceptionci\</font> object try { // call clearimage net api } 	catch (exceptionci ex) { 	 std wcout << l"error " << ex getmessage() << std endl; 	} barcode reading read 1d barcodes from a page this example reads code 39 and code 128 barcodes set barcode types used in your application setting \<font color="#eb144c">reader \>autodetect1d=true;\</font> automatically finds the barcode type, but it is slower and is not recommended for production void readbarcode1d page(const ciserver \&server, const std wstring \&filename, const long page) { 	try { 	 cibarcodepro reader = server >createbarcodepro(); 	 reader >type = (fbarcodetype)(cibfcode39 | cibfcode128); 	 // reader >autodetect1d = true; 	 reader >image >open(filename, page); 	 reader >find(0); 	 for (int i = 1; i <= reader >barcodes >count; i++) 	 std wcout << reader >barcodes >item\[i 1] >text << std endl; 	} 	catch (exceptionci ex) { 	 std wcout << l"error " << ex getmessage() << std endl; 	} } read 2d barcode from a page this example reads pdf417, datamatrix, and qr code 2d barcodes might contain binary data available in \<font color="#eb144c">cibarcode \>data\</font> property as \<font color="#eb144c">std vector\<char\>\</font> void readbarcode2d page(const ciserver& server, const std wstring& filename, const long page) { 	try { 	 ciqr reader = server >createqr(); 	 // cipdf417 reader = server >createpdf417(); 	 // cidatamatrix reader = server >createdatamatrix(); 	 reader >image >open(filename, page); 	 reader >find(0); 	 for (int i = 1; i <= reader >barcodes >count; i++) 	 std wcout << reader >barcodes >item\[i 1] >text << std endl; 	} 	catch (exceptionci ex) { 	 std wcout << l"error " << ex getmessage() << std endl; 	} } read postal barcodes from a page this example reads postal barcodes from an image file page void readbarcodepostal page(const ciserver& server, const std wstring& filename, const long page) { 	try { 	 cibarcodepro reader = server >createbarcodepro(); 	 reader >type = cibf4state; 	 reader >image >open(filename, page); 	 reader >find(0); 	 for (int i = 1; i <= reader >barcodes >count; i++) 	 { 	 std wstring type = l""; 	 switch (reader >barcodes >item\[i 1] >type) 	 { 	 case cibuspsintelligentmail type = l"us intelligent mail "; break; 	 case cibbpopostcode type = l"uk royal mail "; break; 	 case cibaustralianpost type = l"australian mail "; break; 	 case cibsingaporepost type = l"singapore mail "; break; 	 } 	 std wcout << l"type " << type << l" " << reader >barcodes >item\[i 1] >text << std endl; 	 } 	} 	catch (exceptionci ex) { 	 std wcout << l"error " << ex getmessage() << std endl; 	} } read driver's license barcode this example reads the driver's license barcode from an image file page void readdriverlicbarcode page(const ciserver& server, const std wstring& filename, const long page) { 	try { 	 cipdf417 reader = server >createpdf417(); 	 reader >image >open(filename, page); 	 reader >find(0); 	 for (int i = 1; i <= reader >barcodes >count; i++) { 	 cibarcode bc = reader >barcodes >item\[i 1]; 	 std wcout << bc >text << std endl; 	 if (bc >type == ebarcodetype cibpdf417 && bc >getinfo(l"last") != l"") { 	 std wcout << l"last " << bc >getinfo(l"last") << std endl; 	 std wcout << l"first " << bc >getinfo(l"first") << std endl; 	 std wcout << l"middle " << bc >getinfo(l"middle") << std endl; 	 std wcout << l"suffix " << bc >getinfo(l"suffix") << std endl; 	 std wcout << l"dob " << bc >getinfo(l"dob") << std endl; 	 std wcout << l"eyes " << bc >getinfo(l"eyes") << std endl; 	 std wcout << l"hair " << bc >getinfo(l"hair") << std endl; 	 std wcout << l"sex " << bc >getinfo(l"sex") << std endl; 	 std wcout << l"height " << bc >getinfo(l"height") << std endl; 	 std wcout << l"weight " << bc >getinfo(l"weight") << std endl; 	 std wcout << l"street " << bc >getinfo(l"street") << std endl; 	 std wcout << l"city " << bc >getinfo(l"city") << std endl; 	 std wcout << l"state " << bc >getinfo(l"state") << std endl; 	 std wcout << l"postal " << bc >getinfo(l"postal") << std endl; 	 std wcout << l"country " << bc >getinfo(l"country") << std endl; 	 std wcout << l"id " << bc >getinfo(l"id") << std endl; 	 std wcout << l"issued " << bc >getinfo(l"issued") << std endl; 	 std wcout << l"expires " << bc >getinfo(l"expires") << std endl; 	 } 	 } 	} 	catch (exceptionci ex) { 	 std wcout << l"error " << ex getmessage() << std endl; 	} } read from a multi page image file this example reads barcodes from a single page file or all pages of a multi page image file void readbarcode1d file(const ciserver& server, const std wstring& filename) { 	try { 	 // configure reader 	 cibarcodepro reader = server >createbarcodepro(); 	 reader >type = (fbarcodetype)(cibfcode39 | cibfcode128); 	 int page = 1; 	 while (true) { 	 reader >image >open(filename, page); 	 reader >find(0); 	 for (int i = 1; i <= reader >barcodes >count; i++) 	 std wcout << "page " << page << " text " << reader >barcodes >item\[i 1] >text << std endl; 	 page++;	 	 if (page > reader >image >pagecount) 	 break; 	 } 	} 	catch (exceptionci ex) 	{ 	 std wcout << l"error " << ex getmessage() << std endl; 	} } optimize barcode reading this page docid\ smk4 lgrtfex0zacvu2lv describes methods for improving the recognition rate and/or speed image processing repair image page this example uses some of the most popular image processing functions in a production application, the specific sequence of functions should be selected based on specific application needs void repairpage(const cirepair& repair) { 	repair >autodeskew(); 	repair >autorotate(); 	repair >autocrop(10, 10, 10, 10); 	repair >image >tobitonal(); 	repair >borderextract(eborderextractflags cibexborderdeskewcrop, 	 eborderextractalgorithm cibeacleaner); 	repair >removepunchholes(); 	repair >smoothcharacters(esmoothtype cismoothdarkenedges); 	repair >cleannoiseext ((ecleannoiseflags) (cicnxblacknoise | cicnxwhitenoise), 3, 3, 10); } void repair page(const ciserver& server, const std wstring& filename, const long page, 	const std wstring& fileout) { 	try { 	 cirepair repair = server >createrepair(); 	 repair >image >open(filename, page); 	 repairpage(repair); 	 repair >image >saveas(fileout, efileformat ciext); 	} 	catch (exceptionci ex) { 	 std wcout << l"error " << ex getmessage() << std endl; 	} } repair all images in a multi page file this example repairs all images in a multi page file and saves the result in the \<font color="#eb144c">fileout\</font> file using inlite clearimagenet; void repair file(const ciserver& server, const std wstring& filename, const std wstring& fileout) { 	try { 	 cirepair repair = server >createrepair(); 	 int page = 1; 	 while (true) { 	 repair >image >open(filename, page); 	 repairpage(repair); // see code above 	 if (page == 1) repair >image >saveas(fileout, efileformat ciext); 	 else repair >image >append(fileout, efileformat ciext); 	 page++;	 	 if (page > repair >image >pagecount) 	 break; 	 } 	} 	catch (exceptionci ex) { 	 std wcout << l"error " << ex getmessage() << std endl; 	} }