Module: OcrFile::OcrEngines::Tesseract

Extended by:
Tesseract
Included in:
Tesseract
Defined in:
lib/ocr-file/ocr_engines/tesseract.rb

Instance Method Summary collapse

Instance Method Details

#idObject



6
7
8
# File 'lib/ocr-file/ocr_engines/tesseract.rb', line 6

def id
  'tesseract'
end

#ocr_to_pdf(file_path, options: {}) ⇒ Object



15
16
17
18
19
# File 'lib/ocr-file/ocr_engines/tesseract.rb', line 15

def ocr_to_pdf(file_path, options: {})
  image = ::RTesseract.new(file_path)
  raw_output = image.to_pdf  # Getting open file of pdf
  OcrFile::ImageEngines::PdfEngine.open_pdf(raw_output, password: '')
end

#ocr_to_text(file_path, options: {}) ⇒ Object



10
11
12
13
# File 'lib/ocr-file/ocr_engines/tesseract.rb', line 10

def ocr_to_text(file_path, options: {})
  image = ::RTesseract.new(file_path)
  image.to_s # Getting the value
end