pontedilana / WeasyPrintBundle

Easily create PDF in Symfony by converting HTML using WeasyPrint
MIT License
32 stars 5 forks source link

binary option seems unused in package config #9

Closed maluramichael closed 10 months ago

maluramichael commented 10 months ago

I tried to set the binary path via the config/packages/weasyprint.yaml file.

weasyprint:
    pdf:
        enabled:    true
        binary:     /opt/homebrew/bin/weasyprint
        options:    []
 bin/console debug:config --env prod weasyprint

Current configuration for extension with alias "weasyprint"
===========================================================

weasyprint:
    pdf:
        enabled: true
        binary: /opt/homebrew/bin/weasyprint
        options: {  }
        env: {  }
    image:
        enabled: false
        binary: weasyprint
        options: {  }
        env: {  }

But my code crashes with the following exception

The exit status code '127' says something went wrong:
stderr: "sh: weasyprint: command not found
"
stdout: ""
command: weasyprint '/var/tmp/php_weasyprint6578035f0e4b38.46262560.html' '/private/var/tmp/print26960716KFY0Dk.pdf'

It seems like the custom path is not passed to the inner weasyprint package.

maluramichael commented 10 months ago

Ah i found it myself. Passed the wrong class to my service.

Had to pass @Pontedilana\PhpWeasyPrint\Pdf instead of @weasyprint.pdf