abbyy-client.cr

Abbyy Cloud OCR SDK Client for Crystal.

Build Status

Based on abbyy-client-php.

Installation

Add this to your application's shard.yml:

dependencies:
  abbyy:
    github: TamasSzekeres/abbyy-client.cr

Then run:

crystal deps

Authentication

If you want to use the api, you have to register on Abbyy's site and create an application to get your own application_id and password.

Usage

require "abbyy"

module AbbySample
  include Abbyy
  include Abbyy::Models

  APPLICATION_ID = "_YOUR_APPLCATION_ID_"
  PASSWORD = "_YOUR_PASSWORD_"

  def self.main
    input_file = "ScannedDocument.png"
    output_file = "SearchableDocument.pdf"

    client = Client.new(APPLICATION_ID, PASSWORD)

    request = ProcessImageRequest.new(
      file_path: input_file,
      image_source: ImageSource::Scanner,
      export_format: ExportFormat::PdfTextAndImages)


    # - Send the image to API
    # - Wait for processing
    # - Finally download and return the result
    result = client.perform_image_processing request

    # Saving result to file.
    if task_result = result.as?(TaskResult)
      unless task_result.result.is_a? Nil
        task_result.save_result output_file
      end
    end

    0
  end

  main
end

Resources

License

This package is released under the MIT License.

Contributing

  1. Fork it ( https://github.com/TamasSzekeres/abbyy-client.cr/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors