Skip to content

Commit

Permalink
Implementation of Missing Features in Aspose.Barcode
Browse files Browse the repository at this point in the history
Create Barcode on Aspose Cloud Storage
Generate Barcode with Appropriate Code Text Location
Generate Barcode with Checksum Option
Rotate Barcode Image with Suitable Angle
Set Barcode Image Height, Width and Quality along with Auto Size Option
Set Barcode Image Margin
Set Barcode Image Resolution
Set Height of the Bars in the Barcode Image
Set X and Y Dimensions of a Barcode
Read Barcodes by Applying Image Processing Algorithm
  • Loading branch information
assadvirgo committed May 27, 2015
1 parent 56b7915 commit 560aaa8
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
61 changes: 59 additions & 2 deletions lib/aspose-barcode.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var Utils = require('./utils');
var path = require('path');
var fs = require('fs');
var qs = require('querystring');
var AsposeStorage = require('./aspose-storage');

function AsposeBarcode(config) {
Expand All @@ -11,16 +12,19 @@ function AsposeBarcode(config) {

/* Creation Methods */

AsposeBarcode.prototype.save = function(codeText,symbology,imageFormat,callback){
AsposeBarcode.prototype.save = function(codeText,symbology,imageFormat,options,callback){
codeText = typeof codeText !== 'undefined' ? codeText : '';
symbology = typeof symbology !== 'undefined' ? symbology : 'QR';
imageFormat = typeof imageFormat !== 'undefined' ? imageFormat : 'png';
options = typeof options !== 'undefined' ? options : '';

if(codeText === ''){
throw new Error('Code text not provided.');
}

var strURI = this.baseURI + 'barcode/generate?text=' + codeText + '&type=' + symbology + '&format=' + imageFormat;
var extra_qry_str = qs.stringify(options);

var strURI = this.baseURI + 'barcode/generate?text=' + codeText + '&type=' + symbology + '&format=' + imageFormat + '&' + extra_qry_str;
var signedURI = Utils.Sign(strURI,this.appSID,this.appKey);

Utils.ProcessCommandContent('GET',signedURI,'',function(data){
Expand All @@ -32,6 +36,32 @@ AsposeBarcode.prototype.save = function(codeText,symbology,imageFormat,callback)

};

AsposeBarcode.prototype.save_in_cloud = function(codeText,symbology,fileName,options,callback){
codeText = typeof codeText !== 'undefined' ? codeText : '';
symbology = typeof symbology !== 'undefined' ? symbology : 'QR';
fileName = typeof fileName !== 'undefined' ? fileName : '';
options = typeof options !== 'undefined' ? options : '';

if(codeText === '' || fileName === ''){
throw new Error('Required parameters missing.');
}

var extra_qry_str = qs.stringify(options);

var strURI = this.baseURI + 'barcode/' + fileName + '/generate?text=' + codeText + '&type=' + symbology + '&' + extra_qry_str;
var signedURI = Utils.Sign(strURI,this.appSID,this.appKey);
console.log(signedURI);

Utils.ProcessCommand('PUT',signedURI,'',function(data){

if(typeof callback === 'function'){
callback.call(null,data);
}
});

};


/* Reader Methods */

AsposeBarcode.prototype.readLocal = function(fileStream,symbology,callback){
Expand Down Expand Up @@ -129,6 +159,33 @@ AsposeBarcode.prototype.read = function(fileName,symbology,callback){

};

AsposeBarcode.prototype.readByAlgorithm = function(fileName,algo,callback){
fileName = typeof fileName !== 'undefined' ? fileName : '';
algo = typeof algo !== 'undefined' ? algo : '';

if(fileName === '' || algo === ''){
throw new Error('Missing required parameters.');
}

var strURI = this.baseURI + 'barcode/' + fileName + '/recognize';
if(algo != ''){
strURI = strURI + '?BinarizationHints=' + algo;
}

var signedURI = Utils.Sign(strURI,this.appSID,this.appKey);

Utils.ProcessCommand('GET',signedURI,'',function(data){
if(typeof callback === 'function'){
if(data.Status === 'OK'){
callback.call(null,data.Barcodes);
} else {
throw new Error(data.Message);
}
}
});

};

AsposeBarcode.prototype.readRegion = function(fileName,symbology,x,y,w,h,callback){
fileName = typeof fileName !== 'undefined' ? fileName : '';
symbology = typeof symbology !== 'undefined' ? symbology : '';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "asposecloud",
"version": "1.4.0",
"version": "1.5.0",
"description": "Aspose Cloud SDK for NodeJS",
"main": "lib/aspose-cloud.js",
"scripts": {
Expand Down

0 comments on commit 560aaa8

Please sign in to comment.