numerus/debian
jordi fita mas 4d2379555e Convert invoices to PDF with WeasyPrint
Although it is possible to just print the invoice from the browser, many
people will not even try an assume that they can not create a PDF for
the invoice.

I thought of using Groff or TeX to create the PDF, but it would mean
maintaining two templates in two different systems (HTML and whatever i
would use), and would probably look very different, because i do not
know Groff or TeX that well.

I wish there was a way to tell the browser to print to PDF, and it can
be done, but only with the Chrome Protocol to a server-side running
Chrome instance.   This works, but i would need a Chrome running as a
daemon.

I also wrote a Qt application that uses QWebEngine to print the PDF,
much like wkhtmltopdf, but with support for more recent HTML and CSS
standards.  Unfortunately, Qt 6.4’s embedded Chromium does not follow
break-page-inside as well as WeasyPrint does.

To use WeasyPrint, at first i wanted to reach the same URL as the user,
passing the cookie to WeasyPrint so that i can access the same invoice
as the user, something that can be done with wkhtmltopdf, but WeasyPrint
does not have such option.  I did it with a custom Python script, but
then i need to package and install that script, that is not that much
work, but using the Debian-provided script is even less work, and less
likely to drift when WeasyPrint changes API.

Also, it is unnecessary to do a network round-trip from Go to Python
back to Go, because i can already write the invoice HTML as is to
WeasyPrint’s stdin.
2023-02-26 17:26:09 +01:00
..
source Convert to Debian non-native format 1.0 2023-01-16 10:41:46 +01:00
changelog Convert to Debian non-native format 1.0 2023-01-16 10:41:46 +01:00
control Convert invoices to PDF with WeasyPrint 2023-02-26 17:26:09 +01:00
copyright Add user_profile view to update the profile with form 2023-01-22 02:23:09 +01:00
golang-tandem-numerus-dev.install Split into three debian packages: dev, binary, and sqitch migration 2023-01-16 13:22:16 +01:00
numerus-demo.install Add the SQL for the demo 2023-01-17 22:30:01 +01:00
numerus-sqitch.install Split into three debian packages: dev, binary, and sqitch migration 2023-01-16 13:22:16 +01:00
numerus.install Add Catalan and Spanish translation with gotext[3] 2023-01-18 20:26:30 +01:00
rules Add a deployment test while building the Debian package 2023-01-22 04:32:03 +01:00