lib/grim/page.rb in grim-0.2.4 vs lib/grim/page.rb in grim-0.3.0

- old
+ new

@@ -30,20 +30,11 @@ # Returns a File. # def save(path, options={}) raise PathMissing if path.nil? || path !~ /\S/ - width = options.fetch(:width, Grim::WIDTH) - density = options.fetch(:density, Grim::DENSITY) - quality = options.fetch(:quality, Grim::QUALITY) - - output = SafeShell.execute("convert", "-resize", width, "-antialias", "-render", - "-quality", quality, "-colorspace", "RGB", - "-interlace", "none", "-density", density, - "#{@pdf.path}[#{@index}]", path) - - $? == 0 || raise(UnprocessablePage, output) + Grim.processor.save(@pdf, @index, path, options) end # Extracts the text from the selected page. # # For example: @@ -52,9 +43,9 @@ # # => "This is text from slide 2.\n\nAnd even more text from slide 2." # # Returns a String. # def text - SafeShell.execute("pdftotext", "-enc", "UTF-8", "-f", @number, "-l", @number, @pdf.path, "-") + `#{["pdftotext", "-enc", "UTF-8", "-f", @number, "-l", @number, Shellwords.escape(@pdf.path), "-"].join(' ')}` end end end \ No newline at end of file