3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/asposeocrjava/OCR/workwithdifferentlanguages.rb', line 3
def initialize()
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
ocr_engine = Rjb::import('com.aspose.ocr.OcrEngine').new
ocr_engine.setImage(Rjb::import('com.aspose.ocr.ImageStream').fromFile(data_dir + 'spanish.png'))
ocr_engine.getLanguageContainer().clear()
ocr_engine.getLanguageContainer().addLanguage(Rjb::import('com.aspose.ocr.LanguageFactory').load(data_dir + "SpanishLanguageResources.zip"))
if ocr_engine.process()
puts "Text: " + ocr_engine.getText().to_string
end
end
|