Using knp snappy bundle to generate pdf - symfony2

烈酒焚心 提交于 2019-12-01 11:02:34

Few months later, but here is what helped me.

I put the path to wkthmltopdf folder in escaped double quotes.

knp_snappy:
   pdf:
      binary: "\"C:/Program Files (x86)/wkhtmltopdf/wkhtmltopdf.exe\""

you can also manage wkhtmltopdf with composer too, I did it in a recent project:

in your composer.json you can add:

"h4cc/wkhtmltopdf-amd64": "0.11.0-RC1"

and in your config.yml:

binary:     %kernel.root_dir%/../vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64

You can do one of these

1- Update your config.yml

 pdf:
    enabled:    true
    binary:     wkhtmltopdf
    options:    []
  • And update your windows environment PATH with path/to/my/wkhtmltopdf

2- Or set the path directly in config.yml

pdf:
        enabled:    true
        binary:     /path/to/my/wkhtmltopdf
        options:    []
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!