Meaningless Drivel is fun!*
The moose likes Blatant Advertising and the fly likes Read & Recognize Barcode from External Image URL Using REST API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Other » Blatant Advertising
Bookmark "Read & Recognize Barcode from External Image URL Using REST API" Watch "Read & Recognize Barcode from External Image URL Using REST API" New topic
Author

Read & Recognize Barcode from External Image URL Using REST API

sher azam
Ranch Hand

Joined: Jul 04, 2012
Posts: 60

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, parsing 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 = "http://api.saaspose.com/v1.0/barcode/recognize?type=QR&url=http://upload.wikimedia.org/wikipedia/commons/c/ce/WikiQRCode.png";
// Send the request to Saaspose server
InputStream responseStream = ProcessCommand(Sign(strURI), "POST");
// Read the response
String strJSON = StreamToString(responseStream);
//Parse and Deserializes the JSON to a object.
RecognitionResponse barcodeRecognitionResponse = 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
{
public BaseResponse() { }
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;}
}

Overview: Saaspose.Barcode

Saaspose.Barcode is a cloud based REST API that helps developers to generate new barcode images from scratch, recognize barcodes from images, specify barcode text attributes, set barcode image characteristics like width, height, border style, output format etc. Developers can create barcode using more than 40 symbologies like (1D) EAN13, EAN8, UPCA, UPCE barcode, MSI & Code11 (2D) like PDF417, DataMatrix, Aztec, QR, Italian Post 25 & postal types like Postnet, Planet, USPS OneCode & many more.

More about Saaspose.BarCode

- Homepage of Saaspose.BarCode
- Saaspose.BarCode REST Live Examples
- More Technical Tips by Saaspose.BarCode
- Ask technical questions/queries from Saaspose Support Team

Contact Information
Aspose Pty Ltd, Suite 163,
79 Longueville Road
Lane Cove, NSW, 2066
Australia
Saaspose - Your File Format Experts 2.0
sales@aspose.com
Phone: 1.214.329.1520
Fax: 866.810.9465
 
Don't get me started about those stupid light bulbs.
 
subject: Read & Recognize Barcode from External Image URL Using REST API
 
Similar Threads
Extract Images from Word, Excel, PowerPoint & PDF Files Using REST APIs
Extract Images from Presentation & Create PDF File from These Images
Generate Barcode Image with Custom Size, Better Quality & Readability
Integrate Amazon S3 Storage with Saaspose REST APIs & Process Your Files
Integrate Google Drive Storage & Manipulate Many File Formats in Cloud