Convert a .doc or .pdf to an image and display a thumbnail in Ruby?

前端 未结 6 2281
陌清茗
陌清茗 2020-12-12 21:35

Convert a .doc or .pdf to an image and display a thumbnail in Ruby?
Does anyone know how to generate document thumbnails in Ruby (or C, python...)

6条回答
  •  -上瘾入骨i
    2020-12-12 22:00

    As the 2 previous posters said, ImageMagick's probably the easiest way to generate the thumbnails.

    You could exec something like:

    ´convert -size 300x300 doc.pdf doc.png´
    

    (The backquotes tell Ruby to shell it out).

    If you don't want to use exec to do the conversion you could use the RMagick gem to do it for you but it's probably a bit more of code.

提交回复
热议问题