I've been looking through Vips and Ruby-Vips documentation, and I am not seeing anyway to load and convert a PDF. Imagemagick has the convert command in their CLI tools. Is there an equivalent to convert in Vips? My goal is to convert a PDF to a jpeg in my Rails 3 app.
Asked
Active
Viewed 1,326 times
1 Answers
0
You can open a PDF like any other image file.
a = Vips::Image.new_from_file "/some/file/called.pdf", access: :sequential
a.write_to_file("tiny.jpg")
Optional arguments let you set a rendering resolution, a background colour, and pick a page or set of pages.
The docs for pdfload explain all the options:
https://libvips.github.io/libvips/API/current/VipsForeignSave.html#vips-pdfload

jcupitt
- 10,213
- 2
- 23
- 39