
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@asposecloud/aspose-ocr-cloud
Advanced tools
Aspose.OCR Cloud is a simple SDK used to add text recognition to your app with merely a few lines of code.
In detail, it's a set of SDKs for optical character recognition and document scanning in our Cloud. It supports reading and recognizing text from most commonly used raster image formats. Just pass a specific image to the Aspose.OCR Cloud API, and it will return a response with recognized text.
It is easy to get started with Aspose.OCR Cloud, and there is nothing to install. Create an account at Aspose Cloud and get your application information, then you are ready to use SDKs
Our API is completely independent of your operating system, database system, or development language. You can use any language and platform that supports HTTP to interact with our API. However, manually writing client code can be difficult, error-prone, and time-consuming. Therefore, we have provided and support SDKs in many development languages to make it easier to integrate with us.
To use Aspose OCR for Cloud Node.js SDK you need to register an account with Aspose Cloud and lookup/create App Key and SID at Cloud Dashboard. There is a free quota available. For more details, see Aspose Cloud Pricing.
npm install @asposecloud/aspose-ocr-cloud --save
Install it via:
npm install https://github.com/aspose-ocr-cloud/aspose-ocr-cloud-nodejs --save
Please, add the following nmp package to your project.json as a dependency.
{
"dependencies": {
"@asposecloud/aspose-ocr-cloud":"^21.2.0"
}
}
Please follow the installation instruction and execute the following JS code:
NOTE: Use the helper from /test/helper.js for an upload and save data.
// Get keys from aspose site.
// There is free quota available.
// For more details, see https://purchase.aspose.cloud/pricing
var conf = {
"basePath":"https://api.aspose.cloud/v3.0",
"authPath":"https://api.aspose.cloud/connect/token",
"apiKey":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"appSID":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
};
//Create storage api for upload to server
var fs = require('fs');
var path = require('path');
var instance = new Asposeocrcloud.OcrApi(conf);
var buffer = Buffer.alloc(1024 * 50);
var fileData = fs.readFileSync(YOUR_FILE_PATH, buffer);
instance.RecognizeFromContentAuto(fileData, function (err, data, res) {
console.log(data);
});
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
into the directory containing package.json
(and this README). Let's call this JAVASCRIPT_CLIENT_DIR
. Then run:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
Finally, switch to the directory you want to use your package from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
You should now be able to require('@asposecloud/aspose-ocr-cloud')
in javascript files from the directory you ran the last
command above from.
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually
use this library):
browserify main.js > bundle.js
Then include bundle.js in the OCR pages.
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Before fill all fields in configuration object (see demo)
var conf = {
"basePath":"https://api.aspose.cloud/v3.0",
"authPath":"https://api.aspose.cloud/connect/token",
"apiKey":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"appSID":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
};
//Create storage api for upload to server
var fs = require('fs');
var path = require('path');
var instance = new Asposeocrcloud.OcrApi(conf);
var buffer = Buffer.alloc(1024 * 50);
var fileData = fs.readFileSync(YOUR_FILE_PATH, buffer);
instance.RecognizeFromContentAuto(fileData, function (err, data, res) {
console.log(data);
});
var imageUrl = "https://upload.wikimedia.org/wikipedia/commons/2/2f/Book_of_Abraham_FirstPage.png";
instance.RecognizeFromUrlAuto(imageUrl, function (err, data, res) {
console.log(data);
});
var regions = [
new Asposeocrcloud.OCRRegion(0, new Asposeocrcloud.OCRRect(209,28,283,39)),
new Asposeocrcloud.OCRRegion(1, new Asposeocrcloud.OCRRect(24,114,359,185)),
new Asposeocrcloud.OCRRegion(2, new Asposeocrcloud.OCRRect(21,201,356,451)),
new Asposeocrcloud.OCRRegion(3, new Asposeocrcloud.OCRRect(21,464,359,558))];
var requestData = new Asposeocrcloud.OCRRequestData(regions, Asposeocrcloud.Language.English, false);
instance.RecognizeRegionsFromUrl(imageUrl, requestData, function (err, data, res) {
console.log(data);
});
DEMO Application contain various examples of using the Aspose.OCR SDK NodeJS.
Detailed API Reference is avalable at /docs/ folder.
Image formats suported: .bmp, .dib .jpeg, .jpg, .jpe .jp2 .png .webp .pbm, .pgm, .ppm .pxm, .pnm .pfm .sr, .ras .tiff, .tif .exr .hdr, .pic
FAQs
Aspose OCR Cloud 5.0 API
The npm package @asposecloud/aspose-ocr-cloud receives a total of 2 weekly downloads. As such, @asposecloud/aspose-ocr-cloud popularity was classified as not popular.
We found that @asposecloud/aspose-ocr-cloud demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.