Aspose.OCR Cloud is an optical character recognition as a service. With it, you can easily add OCR functionality to almost any device or platform: cloud, web, PCs, netbooks, or even entry-level smartphones.
Our engine can read text from images, photos, screenshots and scanned PDFs in a wide variety of European, Cyrillic and Oriental fonts, returning results in the most popular document formats. Powerful built-in image processing filters based on neural networks automatically correct skewed and distorted images, automatically remove dirt, smudges, scratches, glare and other image defects that can affect recognition accuracy. To further improve the results, Aspose.OCR Cloud has a built-in spell checker that automatically replaces misspelled words and saves you the trouble of manually correcting the recognition results.
Even the complex recognition tasks can be done with a couple of API calls. To make interacting with Aspose.OCR Cloud services from Go applications even easier, we provide the software development kit (SDK) for Go. It handles all the routine operations such as establishing connections, sending API requests, and parsing responses, wrapping all these tasks into a few simple classes.
Aspose.OCR Cloud SDK for Go is open source under the MIT license. You can freely use it for any projects, including commercial and proprietary applications, as well as modify any part of its code.
Image to Text | Image to Searchable PDF | PDF OCR | Receipt Scanner |
---|---|---|---|
- Go 1.18 or later.
- Internet connection.
- Access to the api.aspose.cloud domain.
Check go.mod file for the full list of third-party dependencies.
Aspose.OCR Cloud is an on-demand service with a free tier. In order to use Aspose.OCR Cloud service, you must create an account at Aspose Cloud API:
- Go to https://dashboard.aspose.cloud/
- If you are already registered with Aspose, sign in with your user name and password.
Otherwise, click Don’t have an account? Sign Up link and create a new account. - Check out more information about available subscription plans and a free tier limits.
Aspose values your privacy and takes technical, security and organizational measures to protect your data from unauthorized use, accidental loss or disclosure. Read our Privacy Policy and Terms of Service for details.
Aspose.OCR Cloud follows industry standards and best practices to keep your data secure. All communication with OCR REST API is done using JWT authentication, which provides an open-standard, highly secure way to exchange information. Time-limited JWT tokens are generated using Client ID and Client Secret credentials that are specific for each application. To obtain the credentials:
-
Sign in to Aspose Cloud API Dashboard.
-
Go to Applications page.
-
Click Create New Application button.
-
Give the application an easily recognizable name so it can be quickly found in a long list, and provide an optional detailed description.
-
Create the cloud storage by clicking the plus icon and following the required steps. You can also reuse existing storage, if available.
Aspose.OCR Cloud uses its own internal storage, so you can provide the bare minimum storage options:- Type: Internal storage
- Storage name: Any name you like
- Storage mode: Retain files for 24 hours
-
Click Save button.
-
Click the newly created application and copy the values from Client Id and Client Secret fields.
-
Pass in the values from the Client ID and Client Secret fields when initializing the required OCR API.
- Clone this repository or download it as ZIP.
- Install Aspose.OCR Cloud SDK for Go package:
go get github.com/aspose-ocr-cloud/aspose-ocr-cloud-go
- Open examples/example.go file and replace "YOUR_CLIENT_ID" and "YOUR_CLIENT_SECRET" with credentials obtained during Authorization phase:
func main() {
clientId := "YOUR_CLIENT_ID"
clientSecret := "YOUR_CLIENT_SECRET"
- Open the terminal and navigate to the example directory of the downloaded repository.
- Run the example:
go run .\example.go
- Recognition results will be saved to the
results
directory of the downloaded repository.
We also provide automated tests for Testify.
- Clone this repository or download it as ZIP.
- Install dependencies:
go get github.com/stretchr/testify/assert
go get github.com/stretchr/testify/require
go get golang.org/x/oauth2
- Open test/test_config.go file and replace "YOUR_CLIENT_ID" and "YOUR_CLIENT_SECRET" with credentials obtained during Authorization phase:
package asposeocrcloud
var (
ConfigClientID = "YOUR_CLIENT_ID"
ConfigClientSecret = "YOUR_CLIENT_SECRET"
)
- Open the terminal and navigate to the test directory of the downloaded repository.
- Run tests:
go test github.com/aspose-ocr-cloud/aspose-ocr-cloud-go/test
- Test results will be saved to the
results
directory of the downloaded repository.
A summary of recent changes, enhancements and bug fixes in Aspose.OCR Cloud SDK for .NET 23.12.0 release:
Key | Summary | Category |
---|---|---|
OCR‑3737 | Added a free API for evaluating image recognition without authorization. Some restrictions apply. See below for details. |
New feature |
This section lists all public API changes introduced in Aspose.OCR Cloud SDK for .NET 23.12.0 that may affect the code of existing applications.
The following public APIs have been introduced in this release:
The following new classes have been added:
Class | Description |
---|---|
RecognizeImageTrialApi |
Image recognition API that works without authorization. |
Important: In recognition results, 10% of the words are substituted with asterisks (*
). The sequence of masked words remains unchanged upon re-submitting the identical image for recognition.
No changes
No changes.
The example below illustrates how to use Aspose.OCR Cloud SDK for Go to extract text from an image:
package main
import (
"context"
"encoding/base64"
"fmt"
"io/ioutil"
asposeocrcloud "github.com/aspose-ocr-cloud/aspose-ocr-cloud-go"
)
func main(){
clientId := "YOUR_CLIENT_ID"
clientSecret := "YOUR_CLIENT_SECRET"
configuration := asposeocrcloud.NewConfiguration(clientId, clientSecret)
apiClient := asposeocrcloud.NewAPIClient(configuration)
filePath := "../samples/latin.png" // Path to your file
// Read your file data and convert it into base64 string
fileBytes, err := ioutil.ReadFile(filePath)
if err != nil || fileBytes == nil {
fmt.Println("Read file error:", err)
return
}
fileb64Encoded := base64.StdEncoding.EncodeToString(fileBytes)
// Step 1: create request body and sent it to OCR Cloud to receive task ID
recognitionSettings := *asposeocrcloud.NewOCRSettingsRecognizeImage()
recognitionSettings.Language = asposeocrcloud.LANGUAGE_ENGLISH.Ptr()
recognitionSettings.DsrMode = asposeocrcloud.DSRMODE_NO_DSR_NO_FILTER.Ptr()
recognitionSettings.DsrConfidence = asposeocrcloud.DSRCONFIDENCE_DEFAULT.Ptr()
*recognitionSettings.MakeBinarization = false
*recognitionSettings.MakeSkewCorrect = false
*recognitionSettings.MakeUpsampling = false
*recognitionSettings.MakeSpellCheck = false
*recognitionSettings.MakeContrastCorrection = false
recognitionSettings.ResultType = asposeocrcloud.RESULTTYPE_TEXT.Ptr()
recognitionSettings.ResultTypeTable = asposeocrcloud.RESULTTYPETABLE_TEXT.Ptr()
requestBody := *asposeocrcloud.NewOCRRecognizeImageBody(
fileb64Encoded,
recognitionSettings,
)
taskId, httpRes, err := apiClient.RecognizeImageApi.PostRecognizeImage(context.Background()).OCRRecognizeImageBody(requestBody).Execute()
if err != nil || httpRes.StatusCode != 200 {
fmt.Println("API error:", err)
return
}
fmt.Printf("File successfully sent. Your TaskID is %s \n", taskId)
// Step 2: request task results using task ID
ocrResp, httpRes, err := apiClient.RecognizeImageApi.GetRecognizeImage(context.Background()).Id(taskId).Execute()
if err != nil|| httpRes.StatusCode != 200 || ocrResp == nil {
fmt.Println("API error:", err)
return
}
if *ocrResp.TaskStatus == asposeocrcloud.OCRTASKSTATUS_COMPLETED {
if !ocrResp.Results[0].Data.IsSet() {
fmt.Println("Response is empty")
return
}
// Decode results and write to file
decodedBytes, err := base64.StdEncoding.DecodeString(*ocrResp.Results[0].Data.Get())
if err != nil {
fmt.Println("Decode error:", err)
return
}
resultFilePath := "../results/" + taskId + ".txt"
err = ioutil.WriteFile(resultFilePath, decodedBytes, 0644)
if err != nil {
fmt.Println("Write file error:", err)
return
}
fmt.Printf("Task result successfully saved at %s \n", resultFilePath)
} else {
fmt.Printf("Sorry, task %s is not completed yet. You can request results later. Task status: %s\n", taskId, *ocrResp.TaskStatus)
}
}
- Aspose.OCR Cloud for Go
Extract text with Aspose.OCR Cloud API in your Go cloud, online and on-premises applications. - Aspose.OCR Cloud for Java
Call Aspose.OCR Cloud API from cross-platform Java apps. - Aspose.OCR Cloud for Python
Natively integrate OCR features into Python applications. - Aspose.OCR Cloud for Node.js
Add OCR functionality to AWS Lambda, Azure Functions, services, and applications written in Node.js by querying our REST API. - Aspose.OCR Cloud for Android
Turn a smartphone into a full featured OCR scanner. Aspose.OCR service runs in the cloud and supports even entry-level and legacy smartphones.
Find more information on Aspose.OCR Cloud and get professional help: