Linux OCR Daemon with Engine 9.0

FineReader Engine
Knowledge Base & Support
Code Samples Collection
Integration, Recognition
image: icon_scriptautomation.gif


  • A daemon on Linux/Unix is like a service under windows, they can be
    • Started or stopped
      • Together with the OS
      • On schedule or
      • Manually
    • The service also stops if a critical runtime error occurs.
  • Technically it is a wrapper over ABBYY FineReader Engine 9.0 for Linux
  • Once started, the daemon switches into waiting mode.
  • To use the daemon, a client application is required which sends recognition requests to a predefined daemon port.
    • This port is fixed in Engine distribution, but any experienced developer can change this so that the port becomes selectable or so that the program can to listen to several ports at the same time.
    • The distribution contains also a daemon client sample.
  • The Daemon makes a process copy of itself when a client request comes in. The first (parent) process goes into waiting mode to wait for the next request.
  • The second process (the copy) loads Engine, sets it up according to the request’s parameters, starts a recognition process, detects the end of the recognition process, and responds to the client with a result (success or failure). The client waits for a result all this time.
  • Engine is set up in accordance with the commands which are sent to Daemon by the client. All of the commands are identical to CLI commands.
  • As a rule, a service is started under a special system account which is different from the user account and has more or fewer privileges.


  • The daemon code ABBYY provides is a sample how FineReader Engine Linux can be used.
  • This sample demonstrates that it is possible to implement the service architecture based on the ABBYY Engine
  • It shows how to use ABBYY OCR technologies and it determines the current features and advantages.
  1. OS service
  2. Asynchronous tasking from different clients
  3. Number of requests is not fixed
  4. Interchange protocol is TCP/IP
  5. Listens to port 7000, accepts requests from any client address
  6. All features of Engine CLI in command line mode


Since the code is “just” a sample it might not be 100% production ready, since it is:

  • Tested only on a local client
  • Works with absolute file paths
  • Accepts only Engine CLI command lines
  • Returns only an exit code of success or error

Advantages of using a daemon

  1. Separates recognition into a detached process. Daemon itself is quite simple, so it’s very stable. A recognition error makes the child process stop whereas the parent process is continuing to handle the client’s requests.
  2. Daemon can be started with more or fewer privileges than any user account has.
  3. Client-server architecture. One service can process requests from several clients simultaneously.
  4. Being a dispatcher for Engine, makes it possible to conceal the location of Engine from clients.


  • Daemon is exactly where recognition process service functions can be implemented, e.g.: queuing, workload balancing, audit, statistics gathering, and custom security options. Those are functions which aren’t implemented in Engine and shouldn’t be implemented on the client side.
  • You can compile your own executable daemon application with all the functionality you would like to have for this service, e.g. a daemon that exports searchable PDF with one special call.


Engine distribution contains a Daemon sample.The sample includes:

  • The source code of Daemon.
  • The source code of a Daemon client.

The Daemon client is a CLI application. Its job is to send its command line parameters to Daemon using TCP/IP (address and to receive an exit code.

Back to: FineReader Engine for Linux

This website uses cookies which enable you to see pages or use other functions of our websites. You can turn off such cookies in your browser’s settings. If you continue to use these pages, you consent to the use of cookies.
  • No tags, yet