Operational systems: Linux OCR quick start guide

For an application with OCR functionality which will be run under Linux operating system, the recognition engine provided by ABBYY Cloud OCR SDK can be especially convenient. It does not depend on operating system or programming language: the only requirement is that you should be able to send HTTP POST and GET requests to access the Web API.

In this tutorial, we will use the Java code sample to work out simple steps for recognizing text on Linux. You may also find useful our samples in Ruby, Python, Bash (with cURL). See on GitHub.

  1. If you do not have Java Development Kit, please download and install the latest version from Oracle.
  2. If you have not yet created an account with Cloud OCR SDK, please register. Registration takes only a little time, and you can use your Google or Facebook account. After registration you will be able to create an Application ID and receive the Application Password, required for every connection to the processing server. See details in Authentication.
  3. Download the Java sample and unzip it.
  4. Customize the URL for HTML requests. To do this, open the Abbyy.Ocrsdk.client/src/com/abbyy/ocrsdk/Client.java file and set the value tag of the ServerAddress setting according to the location center. For example, for processing data in Europe, set the value as following:
    public String serverUrl = "https://cloud-eu.ocrsdk.com";
  5. Edit the Abbyy.Ocrsdk.client/src/ClientSettings.java file to specify the Application ID and Password:
    // Name of application you created
    public static final String APPLICATION_ID = "";
    // Password should be sent to your e-mail after application was created
    public static final String PASSWORD = "";
  6. Build the sample application and run it to recognize an image and save the result as a plain text file:
    javac *.java
    java TestApp recognize image.jpg result.txt
  7. Many other processing options are available. Run java TestApp without any arguments to display the full list:
    Java sample help screen
  8. Please note also that the sample is pre-configured to recognize texts in English. If your documents are written in other languages, use the --lang=<comma-separated list of languages> command-line option.
  9. Modify the sample to fit the requirements for your application. In addition to TestApp.java which we saw above, there is also ProcessManyFiles.java, designed to recognize all images in a folder or all images located at URLs listed in a text file.

For further information, see How to Work with Cloud OCR SDK, which describes a simple use case, and API Reference, which contains full details about any of the methods used by the sample.

Have more questions? Submit a request



Please sign in to leave a comment.