lib/grim/page.rb in grim-1.0.0 vs lib/grim/page.rb in grim-1.1.0
- old
+ new
@@ -6,15 +6,20 @@
# Sets up some instance variables on new instance.
#
# pdf - the pdf this page belongs to
# index - the index of the page in the array of pages
+ # options - A Hash of options.
+ # :pdftotext_path - The String path of where to find the pdftotext
+ # binary to use when extracting text
+ # (default: "pdftotext").
#
- def initialize(pdf, index)
+ def initialize(pdf, index, options = {})
@pdf = pdf
@index = index
@number = index + 1
+ @pdftotext_path = options[:pdftotext_path] || 'pdftotext'
end
# Extracts the selected page and turns it into an image.
# Tested on png and jpeg.
#
@@ -43,9 +48,9 @@
# # => "This is text from slide 2.\n\nAnd even more text from slide 2."
#
# Returns a String.
#
def text
- `#{["pdftotext", "-enc", "UTF-8", "-f", @number, "-l", @number, Shellwords.escape(@pdf.path), "-"].join(' ')}`
+ `#{[@pdftotext_path, "-enc", "UTF-8", "-f", @number, "-l", @number, Shellwords.escape(@pdf.path), "-"].join(' ')}`
end
end
-end
\ No newline at end of file
+end