# cloudmersive-ocr-api-client CloudmersiveOcrApiClient - the Ruby gem for the ocrapi The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text. This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: v1 - Package version: 1.3.3 - Build package: io.swagger.codegen.languages.RubyClientCodegen ## Installation ### Build a gem To build the Ruby code into a gem: ```shell gem build cloudmersive-ocr-api-client.gemspec ``` Then either install the gem locally: ```shell gem install ./cloudmersive-ocr-api-client-1.3.3.gem ``` (for development, run `gem install --dev ./cloudmersive-ocr-api-client-1.3.3.gem` to install the development dependencies) or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). Finally add this to the Gemfile: gem 'cloudmersive-ocr-api-client', '~> 1.3.3' ### Install from Git If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: gem 'cloudmersive-ocr-api-client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' ### Include the Ruby code directly Include the Ruby code directly using `-I` as follows: ```shell ruby -Ilib script.rb ``` ## Getting Started Please follow the [installation](#installation) procedure and then run the following code: ```ruby # Load the gem require 'cloudmersive-ocr-api-client' # Setup authorization CloudmersiveOcrApiClient.configure do |config| # Configure API key authorization: Apikey config.api_key['Apikey'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) #config.api_key_prefix['Apikey'] = 'Bearer' end api_instance = CloudmersiveOcrApiClient::ImageOcrApi.new image_file = File.new("/path/to/file.txt") # File | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. 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). } begin #Convert a scanned image into words with location result = api_instance.image_ocr_image_lines_with_location(image_file, opts) p result rescue CloudmersiveOcrApiClient::ApiError => e puts "Exception when calling ImageOcrApi->image_ocr_image_lines_with_location: #{e}" end ``` ## Documentation for API Endpoints All URIs are relative to *https://api.cloudmersive.com* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_image_lines_with_location**](docs/ImageOcrApi.md#image_ocr_image_lines_with_location) | **POST** /ocr/image/to/lines-with-location | Convert a scanned image into words with location *CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_image_words_with_location**](docs/ImageOcrApi.md#image_ocr_image_words_with_location) | **POST** /ocr/image/to/words-with-location | Convert a scanned image into words with location *CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_photo_to_text**](docs/ImageOcrApi.md#image_ocr_photo_to_text) | **POST** /ocr/photo/toText | Convert a photo of a document into text *CloudmersiveOcrApiClient::ImageOcrApi* | [**image_ocr_post**](docs/ImageOcrApi.md#image_ocr_post) | **POST** /ocr/image/toText | Convert a scanned image into text *CloudmersiveOcrApiClient::PdfOcrApi* | [**pdf_ocr_pdf_to_lines_with_location**](docs/PdfOcrApi.md#pdf_ocr_pdf_to_lines_with_location) | **POST** /ocr/pdf/to/lines-with-location | Convert a PDF into text lines with location *CloudmersiveOcrApiClient::PdfOcrApi* | [**pdf_ocr_pdf_to_words_with_location**](docs/PdfOcrApi.md#pdf_ocr_pdf_to_words_with_location) | **POST** /ocr/pdf/to/words-with-location | Convert a PDF into words with location *CloudmersiveOcrApiClient::PdfOcrApi* | [**pdf_ocr_post**](docs/PdfOcrApi.md#pdf_ocr_post) | **POST** /ocr/pdf/toText | Converts an uploaded PDF file in common formats such as JPEG, PNG into text via Optical Character Recognition. *CloudmersiveOcrApiClient::PreprocessingApi* | [**preprocessing_unrotate**](docs/PreprocessingApi.md#preprocessing_unrotate) | **POST** /ocr/preprocessing/image/unrotate | Detect and unrotate a document image *CloudmersiveOcrApiClient::PreprocessingApi* | [**preprocessing_unskew**](docs/PreprocessingApi.md#preprocessing_unskew) | **POST** /ocr/preprocessing/image/unskew | Detect and unskew a photo of a document ## Documentation for Models - [CloudmersiveOcrApiClient::ImageToLinesWithLocationResult](docs/ImageToLinesWithLocationResult.md) - [CloudmersiveOcrApiClient::ImageToTextResponse](docs/ImageToTextResponse.md) - [CloudmersiveOcrApiClient::ImageToWordsWithLocationResult](docs/ImageToWordsWithLocationResult.md) - [CloudmersiveOcrApiClient::OcrLineElement](docs/OcrLineElement.md) - [CloudmersiveOcrApiClient::OcrPageResult](docs/OcrPageResult.md) - [CloudmersiveOcrApiClient::OcrPageResultWithLinesWithLocation](docs/OcrPageResultWithLinesWithLocation.md) - [CloudmersiveOcrApiClient::OcrPageResultWithWordsWithLocation](docs/OcrPageResultWithWordsWithLocation.md) - [CloudmersiveOcrApiClient::OcrWordElement](docs/OcrWordElement.md) - [CloudmersiveOcrApiClient::PdfToLinesWithLocationResult](docs/PdfToLinesWithLocationResult.md) - [CloudmersiveOcrApiClient::PdfToTextResponse](docs/PdfToTextResponse.md) - [CloudmersiveOcrApiClient::PdfToWordsWithLocationResult](docs/PdfToWordsWithLocationResult.md) ## Documentation for Authorization ### Apikey - **Type**: API key - **API key parameter name**: Apikey - **Location**: HTTP header