Read & Recognize Barcode from External Image URL Using REST API

Posted by Zarfishan under News and Community category on | Points: 40 | Views : 3042
This technical tip allows developers to read barcode from external image URL using Saaspose.BarCode REST API in your Java applications.Some important steps for performing this task is to build URI for reading barcode, sending the request to Saaspose server, parse and Deserializes the JSON to an object and display the value and type of all the recognized barcodes.

Sample Code for Reading Barcode from external image URL

//build URI to read barcode
//type: Codabar, Code11, Code128 and Code39Extended etc.
String strURI = "";
// Send the request to Saaspose server
InputStreamresponseStream = ProcessCommand(Sign(strURI), "POST");
// Read the response
String strJSON = StreamToString(responseStream);
//Parse and Deserializes the JSON to a object.
RecognitionResponsebarcodeRecognitionResponse = gson.fromJson(strJSON,RecognitionResponse.class);
List<RecognizedBarCode> barcodes = barcodeRecognitionResponse.getBarcodes();

// Display the value and type of all the recognized barcodes
for (RecognizedBarCode barcode : barcodes)
System.out.println("Codetext: " + barcode.BarcodeValue() + "\nType: " + barcode.getBarcodeType());

\\Here is the RecognitionResponse class
public class RecognitionResponse extends BaseResponse
private List<RecognizedBarCode> Barcodes ;
public List<RecognizedBarCode>getBarcodes(){return Barcodes;}

\\Here is the RecognizedBarCode class
public class RecognizedBarCode
private String BarcodeType ;
private String BarcodeValue;
public String getBarcodeType(){return BarcodeType;}
public String BarcodeValue(){return BarcodeValue;}

\\Here is the BaseResponse class
public class BaseResponse
publicBaseResponse() { }
private String Code;
private String Status;
public String getCode(){return Code;}
public String getStatus(){return Status;}
public void setCode(String temCode){ Code=temCode;}
public void setStatus(String temStatus){ Status=temStatus;}

Comments or Responses

Posted by: Karl on: 3/10/2013 Level:Starter | Status: [Member] | Points: 10
There is a barcode recognition API for C# available, which help developers to read and decode barcode images in C# developmental environment.
Posted by: Mariah on: 10/16/2013 Level:Starter | Status: [Member] | Points: 10
but i used another one barcode recognition api,which seems the same with that one

Login to post response