Skip to content

Commit 552a4db

Browse files
author
August
committed
A little testing and refinement of the pdf-to-jpg conversion method
1 parent 86881ae commit 552a4db

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/pdf_to_jpg.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ def pdf_to_jpg(pdf_location)
1111

1212
pdf = Magick::ImageList.new(pdf_location)
1313

14-
pdf.each do |page|
15-
write_filename = tmp_location + "/" + file_name + "." + page.to_i + ".jpg"
14+
pdf.each_with_index do |page, i|
15+
write_filename = tmp_location + "/" + file_name + "." + i.to_s + ".jpg"
1616
#write the JPG files to the directory specified
17-
pdf[page].write(write_filename)
17+
pdf[i].write(write_filename)
1818
#appends full filename to array
1919
converted_jpgs << write_filename
2020
end

0 commit comments

Comments
 (0)