package com.aspose.barcode.examples.barcode.advanced_features;

import com.aspose.barcode.CodabarChecksumMode;
import com.aspose.barcode.EnableChecksum;
import com.aspose.barcode.barcoderecognition.BarCodeReader;
import com.aspose.barcode.barcoderecognition.ChecksumValidation;
import com.aspose.barcode.barcoderecognition.DecodeType;
import com.aspose.barcode.examples.Utils;

public class ApplyingChecksumForCodaBar 
{
	public static void main(String[] args) 
        {

		// ExStart:ApplyingChecksumValidation

		// The path to the resource directory.
		String dataDir = Utils.getDataDir(ApplyingChecksumValidation.class) + "Barcode/AdvancedFeatures/";

                //Generation
                //Instantiate BarCodeBuilder object
                com.aspose.barcode.BarCodeBuilder builder = new com.aspose.barcode.BarCodeBuilder();
        
                //Set the Code text for the barcode
                builder.setCodeText("1234567890");
        
                //Set the symbology type to CodaBar
                builder.setEncodeType(com.aspose.barcode.EncodeTypes.CODABAR);
        
                //Set the EnableChecksum property to yes
                builder.setEnableChecksum(EnableChecksum.YES);
        
                //Set the CodabarChecksumMode
                builder.setCodabarChecksumMode(CodabarChecksumMode.MOD_10);
        
                //Save the image on the system
                builder.save("Codabar_Mod10.png");

                //Recognition
                //Initialize reader object
                BarCodeReader reader = new BarCodeReader("Codabar_Mod10.png", com.aspose.barcode.barcoderecognition.DecodeType.CODABAR);
        
                //Set ChecksumValidation property of the reader to On
                reader.setChecksumValidation(ChecksumValidation.ON);
                while (reader.read())
                {
                     //Get code text
                     System.out.println(" codetext: " + reader.getCodeText());
            
                     //Get type of barcode
                     System.out.println(" type: " + reader.getCodeType());
            
                    //Get checksum value
                    System.out.println(" Checksum: " + reader.getCheckSum());
                }		

		// ExEnd:ApplyingChecksumValidation
	}
}

@@ -57,16 +57,45 @@
 tures;%0A%0A
+import java.io.IOException;%0A%0A
 import c
@@ -330,37 +330,22 @@
 ode.
-barcoderecognition.DecodeType
+examples.Utils
 ;%0Aim
@@ -368,30 +368,43 @@
 barcode.
-examples.Utils
+generation.BarCodeGenerator
 ;%0A%0Apubli
@@ -481,21 +481,36 @@
 %5D args) 
-%0A    
+throws IOException %0A
     %7B%0A%0A%09
@@ -692,24 +692,16 @@
 res/%22;%0A%0A
-        
         
@@ -709,32 +709,24 @@
 /Generation%0A
-        
         //In
@@ -742,22 +742,24 @@
  BarCode
-Builde
+Generato
 r object
@@ -771,311 +771,57 @@
     
-        com.aspose.barcode.BarCodeBuilder builder = new com.aspose.barcode.BarCodeBuilder();%0A        %0A                //Set the Code text for the barcode%0A                builder.setCodeText(%221234567890%22);%0A        %0A                //Set the symbology type to CodaBar%0A                builder.setEncodeType
+BarCodeGenerator generator = new BarCodeGenerator
 (com
@@ -847,32 +847,46 @@
 odeTypes.CODABAR
+, %221234567890%22
 );%0A        %0A    
@@ -877,32 +877,24 @@
 );%0A        %0A
-        
         //Se
@@ -942,41 +942,41 @@
     
-        builder.setEnableChecksum
+generator.getChecksum().setEnable
 (Ena
@@ -1006,32 +1006,24 @@
    %0A        
-    
-    
 //Set the Co
@@ -1048,33 +1048,27 @@
         
-        builder.s
+generator.g
 etCodaba
@@ -1064,24 +1064,30 @@
 r.getCodabar
+().set
 ChecksumMode
@@ -1121,32 +1121,24 @@
 );%0A        %0A
-        
         //Sa
@@ -1176,22 +1176,16 @@
     
-        builde
+generato
 r.sa
@@ -1218,24 +1218,16 @@
         
- 
-       
 //Recogn
@@ -1232,24 +1232,16 @@
 gnition%0A
-        
         
@@ -1275,24 +1275,16 @@
         
-     
-   
 BarCodeR
@@ -1401,32 +1401,24 @@
 );%0A        %0A
-        
         //Se
@@ -1475,24 +1475,16 @@
         
- 
-       
 reader.s
@@ -1536,24 +1536,16 @@
         
- 
-       
 while (r
@@ -1558,24 +1558,16 @@
 read())%0A
-        
         
@@ -1572,37 +1572,25 @@
   %7B%0A        
-             
+%09
 //Get code t
@@ -1593,25 +1593,16 @@
 de text%0A
-         
         
@@ -1684,33 +1684,24 @@
             
-   
-      
 //Get type o
@@ -1710,25 +1710,16 @@
 barcode%0A
-         
         
@@ -1797,32 +1797,24 @@
             
-     
-   
 //Get checks
@@ -1822,24 +1822,16 @@
 m value%0A
-        
         
@@ -1888,32 +1888,24 @@
 heckSum());%0A
-        
         %7D%09%09%0A
@@ -1904,17 +1904,16 @@
     %7D%09%09%0A
-%0A
 %09%09// ExE

Update ApplyingChecksumForCodaBar.java