Module: Pdf2image

Defined in:
lib/pdf2image.rb,
lib/pdf2image/version.rb

Overview

converts pdf to jpeg

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.convert(path) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pdf2image.rb', line 12

def self.convert(path)
  filepath = File.dirname(path)
  extn = File.extname path
  filename = File.basename path, extn

  pdf = Magick::ImageList.new(path)
  if pdf.format == "PDF"
    pdf.write(filepath + "/" + filename + ".jpg")
    STDOUT.puts "\033[107;31m Your file saved in #{filepath}\033[0m"
  else
    raise StandardError, "Please enter valid PDF file path!"
  end
end

.welcomeObject



8
9
10
# File 'lib/pdf2image.rb', line 8

def self.welcome
  puts "You are using Pdf2image Gem!!"
end