douzhong8856 2017-06-25 12:32
浏览 47

添加从PDF生成缩略图的功能

I'm looking for a way to integrate (my guess is it should be a filter) generation of thumbnails from PDFs into Liip Imagine Bundle for Symfony 2.

So far I know I will need to use ImageMagick as a driver. I did read about custom filters in LiipImagineBundle documentation, but it's very minimal and has no real example, so I'm not entirely sure where to start (therefore I have no code to share here as for that moment).

My only guess here is that my filter should only generate the image from PDF (first page to be accurate) and pass it further to thumbnail filter. This way it will be able to apply other filters as well in the future.

Any advice, guidance or perhaps a short example will be highly appreciated.

  • 写回答

1条回答 默认 最新

  • dream02008 2017-06-25 21:46
    关注

    In ImageMagick 6, to create a thumbnail of the first page of a pdf file, you would use:

    convert image.pdf[0] -thumbnail WxH image.png
    

    where WxH is your desired thumbnail size. You can also replace WxH by some percent such as 50%. You can change the suffix on the output to jpg or whatever you want.

    If you do not get good quality, then add -density 300 before image.pdf[0] to increase the quality of the pdf that is read in.

    评论

报告相同问题?

悬赏问题

  • ¥15 Macbookpro 连接热点正常上网,连接不了Wi-Fi。
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析