use of com.aspose.barcode.barcoderecognition.BarCodeReader in project Aspose.BarCode-for-Java by aspose-barcode.
the class SwitchBarcodeRecognitionModes method main.
public static void main(String[] args) throws Exception {
ApplyALicense.applyALicense();
// The path to the resource directory.
String dataDir = Utils.getDataDir(SwitchBarcodeRecognitionModes.class) + "BarcodeReader/advanced_features/";
// Create an instance of BarCodeReader and set image and symbology type to recognize
BarCodeReader reader = new BarCodeReader(dataDir + "code39Extended.jpg", com.aspose.barcode.barcoderecognition.DecodeType.DATA_MATRIX);
// Set recognition mode
reader.setRecognitionMode(RecognitionMode.ManualHints);
// Set manual hints
reader.setManualHints(ManualHint.InvertImage | ManualHint.IncorrectBarcodes);
// Try to recognize the barcode from the image
while (reader.read()) {
// Display the CodeText
System.out.println("Codetext: " + reader.getCodeText());
}
// Close the reader
reader.close();
}
use of com.aspose.barcode.barcoderecognition.BarCodeReader in project Aspose.BarCode-for-Java by aspose-barcode.
the class Barcode_Recognition method main.
public static void main(String[] args) throws Exception {
ApplyALicense.applyALicense();
// The path to the resource directory.
String dataDir = Utils.getDataDir(Barcode_Recognition.class) + "BarcodeReader/basic_features/";
// Initialize barcode reader
BarCodeReader rd = new BarCodeReader(dataDir + "CodeText.jpg");
// read barcode of type Code39Extended
while (rd.read()) {
// print the code text, if barcode found
System.out.println("CodeText: " + rd.getCodeText().toString());
// print the symbology type
System.out.println("Symbology type: " + rd.getCodeType());
}
}
use of com.aspose.barcode.barcoderecognition.BarCodeReader in project Aspose.BarCode-for-Java by aspose-barcode.
the class ApplyingChecksumForCodaBar method main.
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(com.aspose.barcode.EnableChecksum.Yes);
// Set the CodabarChecksumMode
builder.setCodabarChecksumMode(com.aspose.barcode.CodabarChecksumMode.Mod10);
// 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(com.aspose.barcode.barcoderecognition.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
}
use of com.aspose.barcode.barcoderecognition.BarCodeReader in project Aspose.BarCode-for-Java by aspose-barcode.
the class BarcodeOrientation method main.
public static void main(String[] args) throws Exception {
ApplyALicense.applyALicense();
// The path to the resource directory.
String dataDir = Utils.getDataDir(BarcodeOrientation.class) + "BarcodeReader/advanced_features/";
// Read code39 barcode from image
String image = dataDir + "code39Extended.jpg";
BarCodeReader reader = new BarCodeReader(image, com.aspose.barcode.barcoderecognition.DecodeType.CODE_39_STANDARD);
// Set orientation
reader.setOrientationHints(Orientation.Rotate90);
// Try to recognize all possible barcodes in the image
while (reader.read()) {
System.err.println("Codetext: " + reader.getCodeText());
}
// Close reader
reader.close();
}
Aggregations