cloudmersive-ocr-api-client-async
CloudmersiveOcrApiClientAsync - JavaScript client for cloudmersive-ocr-api-client-async
The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text.
Cloudmersive OCR API provides advanced machine learning capabilities for converting scanned documents and photos of documents and receipts to text. Async/await API.
- API version: v1
- Package version: 1.3.3
Installation
$3
#### npm
To publish the library as a
npm,
please follow the procedure in
"Publishing npm packages".
Then install it via:
``
shell
npm install cloudmersive-ocr-api-client-async --save
`
##### Local development
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:
`
shell
npm install
`
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
`
shell
npm link
`
Finally, switch to the directory you want to use your cloudmersive-ocr-api-client-async from, and run:
`
shell
npm link /path/to/
`
You should now be able to require('cloudmersive-ocr-api-client-async')
in javascript files from the directory you ran the last
command above from.
#### git
#
If the library is hosted at a git repository, e.g.
https://github.com/GIT_USER_ID/GIT_REPO_ID
then install it via:
`
shell
npm install GIT_USER_ID/GIT_REPO_ID --save
`
$3
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):
`
shell
browserify main.js > bundle.js
`
Then include bundle.js in the HTML pages.
$3
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:
`
javascript
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
`
Getting Started
Please follow the installation instruction and execute the following JS code:
`
javascript
var CloudmersiveOcrApiClientAsync = require('cloudmersive-ocr-api-client-async');
var defaultClient = CloudmersiveOcrApiClientAsync.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Apikey.apiKeyPrefix['Apikey'] = "Token"
var api = new CloudmersiveOcrApiClientAsync.ImageOcrApi()
var imageFile = "/path/to/file.txt"; // {File} Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
var opts = {
'language': "language_example", // {String} Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish)
'preprocessing': "preprocessing_example" // {String} Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended).
};
api.imageOcrImageLinesWithLocation(imageFile, opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
``
Documentation for API Endpoints
All URIs are relative to
https://api.cloudmersive.com
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
CloudmersiveOcrApiClientAsync.ImageOcrApi |
imageOcrImageLinesWithLocation |
POST /ocr/image/to/lines-with-location | Convert a scanned image into words with location
CloudmersiveOcrApiClientAsync.ImageOcrApi |
imageOcrImageWordsWithLocation |
POST /ocr/image/to/words-with-location | Convert a scanned image into words with location
CloudmersiveOcrApiClientAsync.ImageOcrApi |
imageOcrPhotoRecognizeBusinessCard |
POST /ocr/photo/recognize/business-card | Recognize a photo of a business card, extract key business information
CloudmersiveOcrApiClientAsync.ImageOcrApi |
imageOcrPhotoRecognizeForm |
POST /ocr/photo/recognize/form | Recognize a photo of a form, extract key fields and business information
CloudmersiveOcrApiClientAsync.ImageOcrApi |
imageOcrPhotoRecognizeFormAdvanced |
POST /ocr/photo/recognize/form/advanced | Recognize a photo of a form, extract key fields using stored templates
CloudmersiveOcrApiClientAsync.ImageOcrApi |
imageOcrPhotoRecognizeReceipt |
POST /ocr/photo/recognize/receipt | Recognize a photo of a receipt, extract key business information
CloudmersiveOcrApiClientAsync.ImageOcrApi |
imageOcrPhotoToText |
POST /ocr/photo/toText | Convert a photo of a document into text
CloudmersiveOcrApiClientAsync.ImageOcrApi |
imageOcrPhotoWordsWithLocation |
POST /ocr/photo/to/words-with-location | Convert a photo of a document or receipt into words with location
CloudmersiveOcrApiClientAsync.ImageOcrApi |
imageOcrPost |
POST /ocr/image/toText | Convert a scanned image into text
CloudmersiveOcrApiClientAsync.PdfOcrApi |
pdfOcrPdfToLinesWithLocation |
POST /ocr/pdf/to/lines-with-location | Convert a PDF into text lines with location
CloudmersiveOcrApiClientAsync.PdfOcrApi |
pdfOcrPdfToWordsWithLocation |
POST /ocr/pdf/to/words-with-location | Convert a PDF into words with location
CloudmersiveOcrApiClientAsync.PdfOcrApi |
pdfOcrPost |
POST /ocr/pdf/toText | Converts an uploaded PDF file into text via Optical Character Recognition.
CloudmersiveOcrApiClientAsync.PreprocessingApi |
preprocessingBinarize |
POST /ocr/preprocessing/image/binarize | Convert an image of text into a binarized (light and dark) view
CloudmersiveOcrApiClientAsync.PreprocessingApi |
preprocessingBinarizeAdvanced |
POST /ocr/preprocessing/image/binarize/advanced | Convert an image of text into a binary (light and dark) view with ML
CloudmersiveOcrApiClientAsync.PreprocessingApi |
preprocessingGetPageAngle |
POST /ocr/preprocessing/image/get-page-angle | Get the angle of the page / document / receipt
CloudmersiveOcrApiClientAsync.PreprocessingApi |
preprocessingUnrotate |
POST /ocr/preprocessing/image/unrotate | Detect and unrotate a document image
CloudmersiveOcrApiClientAsync.PreprocessingApi |
preprocessingUnrotateAdvanced |
POST /ocr/preprocessing/image/unrotate/advanced | Detect and unrotate a document image (advanced)
CloudmersiveOcrApiClientAsync.PreprocessingApi |
preprocessingUnskew |
POST /ocr/preprocessing/image/unskew | Detect and unskew a photo of a document
CloudmersiveOcrApiClientAsync.ReceiptsApi |
receiptsPhotoToCSV |
POST /ocr/receipts/photo/to/csv | Convert a photo of a receipt into a CSV file containing structured information from the receipt
Documentation for Models
-
CloudmersiveOcrApiClientAsync.BusinessCardRecognitionResult
-
CloudmersiveOcrApiClientAsync.FieldResult
-
CloudmersiveOcrApiClientAsync.FormDefinitionTemplate
-
CloudmersiveOcrApiClientAsync.FormFieldDefinition
-
CloudmersiveOcrApiClientAsync.FormRecognitionResult
-
CloudmersiveOcrApiClientAsync.FormTableColumnDefinition
-
CloudmersiveOcrApiClientAsync.FormTableDefinition
-
CloudmersiveOcrApiClientAsync.GetPageAngleResult
-
CloudmersiveOcrApiClientAsync.ImageToLinesWithLocationResult
-
CloudmersiveOcrApiClientAsync.ImageToTextResponse
-
CloudmersiveOcrApiClientAsync.ImageToWordsWithLocationResult
-
CloudmersiveOcrApiClientAsync.OcrLineElement
-
CloudmersiveOcrApiClientAsync.OcrPageResult
-
CloudmersiveOcrApiClientAsync.OcrPageResultWithLinesWithLocation
-
CloudmersiveOcrApiClientAsync.OcrPageResultWithWordsWithLocation
-
CloudmersiveOcrApiClientAsync.OcrPhotoTextElement
-
CloudmersiveOcrApiClientAsync.OcrWordElement
-
CloudmersiveOcrApiClientAsync.PdfToLinesWithLocationResult
-
CloudmersiveOcrApiClientAsync.PdfToTextResponse
-
CloudmersiveOcrApiClientAsync.PdfToWordsWithLocationResult
-
CloudmersiveOcrApiClientAsync.PhotoToWordsWithLocationResult
-
CloudmersiveOcrApiClientAsync.Point
-
CloudmersiveOcrApiClientAsync.ReceiptLineItem
-
CloudmersiveOcrApiClientAsync.ReceiptRecognitionResult
-
CloudmersiveOcrApiClientAsync.TableCellResult
-
CloudmersiveOcrApiClientAsync.TableResult
-
CloudmersiveOcrApiClientAsync.TableRowResult
Documentation for Authorization
$3
-
Type: API key
-
API key parameter name: Apikey
-
Location: HTTP header