How to convert PDF files to images using RMagick and Ruby

前端 未结 3 1589
执念已碎
执念已碎 2020-12-25 09:13

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?

3条回答
  •  情话喂你
    2020-12-25 09:20

    Since I can't find a way to deal with PDFs on a per-page basis in RMagick, I'd recommend first splitting the PDF into pages with pdftk's burst command, then dealing with the individual pages in RMagick. This is probably less performant than an all-in-one solution, but unfortunately no all-in-one solution presents itself.

    There's also PDF::Toolkit for Ruby that hooks into pdftk but I've never used it.

提交回复
热议问题