Skip to content

[ADD] install_script: optional PDFKiln as wkhtmltopdf (INSTALL_PDFKILN) - #475

Open
Jamalofski wants to merge 1 commit into
Yenthe666:19.0from
Jamalofski:install-pdfkiln
Open

Jamalofski wants to merge 1 commit into
Yenthe666:19.0from
Jamalofski:install-pdfkiln

Conversation

@Jamalofski

Copy link
Copy Markdown

Since #463 the script installs wkhtmltopdf from the Ubuntu repositories. That package is built without wkhtmltopdf's patched Qt, which Odoo 19 relies on:

  • Odoo passes the report header and footer as --header-html and --footer-html (ir_actions_report.py#L583-L589). An unpatched build ignores both, so reports print without the company header and the page numbers.
  • Printing several records into one PDF stops with "Tried to convert multiple documents in wkhtmltopdf using unpatched QT" (L625-L628).

Ubuntu 26.04 has no wkhtmltopdf package at all.

This PR adds an opt-in option, INSTALL_PDFKILN, False by default. Set to True, the script installs PDFKiln from its signed APT repository instead of Ubuntu's package, on amd64 and arm64. PDFKiln is a drop-in wkhtmltopdf under the MIT license: the wkhtmltopdf 0.12.6 command line in /usr/bin/wkhtmltopdf and /usr/bin/wkhtmltoimage, rendered by a current Chromium. Its --version keeps wkhtmltopdf 0.12.6 (with patched qt), the string Odoo checks. On other architectures, or if the installation fails, the script removes the repository again and falls back to Ubuntu's package. With False, nothing changes.

Tested

  • The modified script, end to end, on a fresh Ubuntu 24.04 (WSL2) with INSTALL_PDFKILN="True": Odoo 19 installed and started by the script, and a demo invoice printed with its header and footer.
  • The wkhtmltopdf section with sudo, curl and dpkg stubbed: False runs exactly as before; True on amd64 and arm64 installs PDFKiln only; i386, or a failed installation, falls back to Ubuntu's package.
  • The install commands are those of PDFKiln's README. Its Odoo CI job runs them in clean ubuntu:24.04, ubuntu:26.04 and debian:trixie containers and prints six standard Odoo 20 documents: all six with their header and footer with PDFKiln, none with Ubuntu 24.04's package (results).

In a Docker container such as test_install/, Chromium's sandbox needs PDFKiln's seccomp profile: Docker's default profile blocks it. On a server or a VM there is nothing to add.

I'm the author of PDFKiln. The 20.0 branch has the same script, so the change applies there as is.

Ubuntu's wkhtmltopdf package is built without wkhtmltopdf's patched Qt:
Odoo prints reports without their header and footer, and refuses to
print several records into one PDF. Ubuntu 26.04 has no wkhtmltopdf
package at all.

INSTALL_PDFKILN="True" installs PDFKiln from its signed APT repository
instead, on amd64 and arm64: the wkhtmltopdf 0.12.6 command line in
/usr/bin, rendered by Chromium. Other architectures, or a failed
installation, fall back to Ubuntu's package. The default, "False",
changes nothing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant