Add --format parameter to WeasyPrint

Apparently, in older version of WeasyPrint it was possible to output
either PNG or PDF, so they had that parameter.  In more recent versions,
the only acceptable is PDF, but they removed the fucking parameter
between versions 51 and 52, to it _will_ fail in recent version of
WeasyPrint.

For now, i am using the same version that Debian 11 does, and let’s
hope it stays like this a long time. (It won’t, of course, but well….)
This commit is contained in:
jordi fita mas 2023-02-26 17:42:38 +01:00
parent 4d2379555e
commit c1a64dd51d
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ func ServeInvoice(w http.ResponseWriter, r *http.Request, params httprouter.Para
return return
} }
if pdf { if pdf {
cmd := exec.Command("weasyprint", "--stylesheet", "web/static/invoice.css", "-", "-") cmd := exec.Command("weasyprint", "--format", "pdf", "--stylesheet", "web/static/invoice.css", "-", "-")
var stderr bytes.Buffer var stderr bytes.Buffer
cmd.Stderr = &stderr cmd.Stderr = &stderr
stdin, err := cmd.StdinPipe() stdin, err := cmd.StdinPipe()