开发者

Generate a thumbnail for the first page of a PDF within a rails App?

开发者 https://www.devze.com 2022-12-18 09:45 出处:网络
Is there anyway to generate a thumbnail image for the first page of an uploaded PDF f开发者_Go百科ile. I want to display this image along with the description (provided by the user) of the file. The f

Is there anyway to generate a thumbnail image for the first page of an uploaded PDF f开发者_Go百科ile. I want to display this image along with the description (provided by the user) of the file.


The first answer from this question looks like it'll do what you want.


You can use an image processing library like ImageMagick to convert a PDF into an image.

Call out to the system with something like:

system("convert -size 150x150 /path/to/uploaded/document.pdf /path/to/thumbnail/file.png")
0

精彩评论

暂无评论...
验证码 换一张
取 消