I have a Rails 3 app with PaperClip/S3...
Is it possible to allow a user to upload a PDF, convert the PDF to images, and then upload?
Thanks!
Take a look at imagemagick and rmagick plugin for ruby. This allows you to do all kinds of image conversions, including PDF to jpeg.
http://rmagick.rubyforge.org/
EDIT:
untested sample code:
require 'RMagick'
pdf = Magick::ImageList.new("doc.pdf")
pdf.write("myimage.jpg")
if doc.pdf has 3 pages, this should output 3 images:
myimage.jpg.0
myimage.jpg.1
myimage.jpg.2
take a look at the end of the documentation on this page, which shows a similar example with a multi-frame gif converted to multiple PNGs using imagelist: http://www.imagemagick.org/RMagick/doc/ilist.html#write
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With