Grim is a simple gem for extracting (reaping) a page from a pdf and converting it to an image as well as extract the text from the page as a string.
Grim is my first Ruby gem! Not technically my first OSS contribution, but definitely my first gem. This project came out of Speaker Deck and is used by Speaker Deck whenever you upload a presentation.
pdf = Grim.reap("/path/to/pdf") count = pdf.count pdf.save('/path/to/image.png') text = pdf.text pdf.each do |page| puts page.text end
This gem is perfect for anyone working with PDF’s that wants to extract single pages as images or the text from a page using Ruby.
posted September 6, 2011 by Hoyt