Created
February 18, 2011 18:29
-
-
Save ecentinela/834154 to your computer and use it in GitHub Desktop.
Convert multiple jpg files to a pdf document
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get the actual directory | |
root_path = Dir.pwd | |
# all files on the actual directory | |
Dir.glob(File.join root_path, '*').each do |file| | |
# check that is a directory | |
if File.directory? file | |
print "Converting #{file}... " | |
# path where image files are | |
path = File.join file, '*.jpg' | |
# use imagemagick convert command | |
`/usr/local/bin/convert '#{path}' '#{file}.pdf'` | |
puts 'done!' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment