diff --git a/abbyy-ocr.js b/abbyy-ocr.js index e4d1512..09bc7f9 100644 --- a/abbyy-ocr.js +++ b/abbyy-ocr.js @@ -30,8 +30,8 @@ AbbyyOcr.prototype.processImage = function (options, callback) { } var opts = { - language: 'English' || options.language, - exportFormat: 'txt' || options.exportFormat, + language: options.language || 'English', + exportFormat: options.exportFormat || 'txt', customOptions: options.customOptions, timeout: Date.now() + (options.timeout || DEFAULT_TIMEOUT), statusCallback: options.statusCallback, @@ -54,8 +54,8 @@ AbbyyOcr.prototype._getUrl = function(path) { AbbyyOcr.prototype._getRequestQueryString = function(options) { var query = { - language: 'English' || options.language, - exportFormat: 'txt' || options.exportFormat + language: options.language || 'English', + exportFormat: options.exportFormat || 'txt' }; var qs = querystring.stringify(query); @@ -222,4 +222,4 @@ function parseTaskStatus(options, callback) { } } -module.exports = AbbyyOcr; \ No newline at end of file +module.exports = AbbyyOcr; diff --git a/bin/abbyy-ocr b/bin/abbyy-ocr index e055a48..8803949 100755 --- a/bin/abbyy-ocr +++ b/bin/abbyy-ocr @@ -9,6 +9,7 @@ program .version(JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version) .option('-a, --app ', 'specify your AppID') .option('-p, --password ', 'your OCRSDK-provided password') + .option('-l, --language [language]', 'comma seperated lanaguage') .option('-i, --input ', 'input image file') .option('-o, --output [file]', 'output file, or send to console') .parse(process.argv); @@ -30,6 +31,10 @@ var options = { statusCallback: function(err, status) { console.log(status); } }; +if (program.language) { + options.language = program.language; +} + if (program.output) { options.outputPath = program.output; }