I use request module to make post request (Coffeescript):
request
method: 'POST'
uri: "http://cloud.ocrsdk.com/processImage"
headers:
Authorization: 'Basic: ' + new Buffer("#{id}:#{password}").toString 'base64'
qs:
language: 'russian'
imageSource: 'scanner'
exportFormat: 'xml'
body: file_content
But I get response 551 "Unsupported image file format". How I must send file? How your server know, which format file have? Must I specify file format anywhere? How must http package look like?
I learn samples (.net and python), watch traffic with WireShark, and try to do the same on nodejs, but it does not work.
Comments
2 comments
Problem solved. file_content must be a Buffer object, not String.
You can also take a look at a third-party library in coffeescript to access cloud ocr sdk: https://github.com/selead/node-ocr
Please sign in to leave a comment.