I have an array of images. How can I combine them into a PDF, with one image per page?
I've taken a look at RGhost and RMagic and the answer might be in there somewhere but it's eluding me right now.
You can use RMagick's ImageList#write
:
If the image format indicated by the filename supports multiple images per file (animated images), write writes all the images in the imagelist to a single file.
Example:
require 'rmagick'
image_list = Magick::ImageList.new("image1.png", "image2.png", "image3.png")
image_list.write("images.pdf")
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