I’d like to take a PDF file and convert it to images, each PDF page becoming a separate image.
“Convert a .doc or .pdf to an image and display a thumbnail in Ruby?” is a similar post, but it doesn’t cover how to make separate images for each page.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ImageMagick can do that with PDFs. Presumably RMagick can do it too, but I’m not familiar with it.
The code from the post you linked to:
pdfis anImageListobject, which according to the documentation delegates many of its methods toArray. You should be able to iterate overpdfand callwriteto write the individual images to files.