Class: PaperlessOCR::PDFpen6

Inherits:
Object
  • Object
show all
Defined in:
lib/paperless/ocr_engines/pdfpen6.rb

Instance Method Summary collapse

Constructor Details

#initializePDFpen6

Returns a new instance of PDFpen6.



9
10
11
12
13
# File 'lib/paperless/ocr_engines/pdfpen6.rb', line 9

def initialize
    @engine = PaperlessOCR::PDFPEN6
    @app = app(@engine)
    @app.activate
end

Instance Method Details

#ocr(options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/paperless/ocr_engines/pdfpen6.rb', line 15

def ocr(options)
  begin
    doc = @app.open MacTypes::Alias.path(options[:file])
    doc.ocr

    app("System Events").processes['PDFpen 6'].visible.set(false)

    while doc.performing_ocr.get
      sleep 1
    end
    doc.close(:saving => :yes)
    sleep 3
  rescue 
    puts "WARNING: There was an error OCRing the document with #{@engine}: #{$!}"
  end
end