Class: Restet::Server::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/restet/server/command.rb

Instance Method Summary collapse

Constructor Details

#initialize(file, slice) ⇒ Command

Returns a new instance of Command.



4
5
6
7
# File 'lib/restet/server/command.rb', line 4

def initialize(file, slice)
  puts file.class.name
  @file, @slice = file, slice
end

Instance Method Details

#execute ⇒ Object



13
14
15
16
17
# File 'lib/restet/server/command.rb', line 13

def execute
  cmd = "tet --text --pageopt \"#{pageopt}\" --outfile - #{File.realpath(@file)}"
  result = `#{cmd}`
  result.gsub(/PDFlib TET: PDFlib Text Extraction Toolkit, 4.0p2\n\(c\) 2002-2010 PDFlib GmbH  www.pdflib.com  [email protected]\n/, '')
end

#pageopt ⇒ Object



9
10
11
# File 'lib/restet/server/command.rb', line 9

def pageopt
  "includebox={{#{@slice['bottom_left'].join(' ')} #{@slice['top_right'].join(' ')}}}"
end