# Changer le moteur de génération de PDF

**URL:** <https://community.dokos.io/t/changer-le-moteur-de-generation-de-pdf/1548>\
**Category:** 🚧 Installation / Administration\
**Created:** [Juillet 17, 2025, 10:37 UTC](https://community.dokos.io/t/changer-le-moteur-de-generation-de-pdf/1548 "2025-07-17T10:37:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gauthier](https://community.dokos.io/user_avatar/community.dokos.io/gauthier/32/1616_2.png) [@Gauthier](https://community.dokos.io/u/Gauthier)\
**Post date:** [Juillet 17, 2025, 10:37 UTC](https://community.dokos.io/t/changer-le-moteur-de-generation-de-pdf/1548/1 "2025-07-17T10:37:17Z")

</div>

Bonjour,

On a des problèmes avec le rendu des pdf avec wkgtmltopdf

Savez vous si il est déjà possible d’utiliser l’autre générateur mentionné dans ce post ?

> **[Why is Frappe Still Using Wkhtmltopdf for PDF Generation?](https://discuss.frappe.io/t/why-is-frappe-still-using-wkhtmltopdf-for-pdf-generation/146403)**
>
> Hi everyone, I would like to raise a concern regarding the PDF generation engine currently used in Frappe/ERPNext — wkhtmltopdf. As many of you probably know, wkhtmltopdf has been obsolete for years. It has not received meaningful updates or...

Merci à vous,

---

<div class="post-metadata">

**Author:** ![chdecultot](https://community.dokos.io/user_avatar/community.dokos.io/chdecultot/32/11_2.png) [@chdecultot](https://community.dokos.io/u/chdecultot)\
**Post date:** [Juillet 17, 2025, 12:27 UTC](https://community.dokos.io/t/changer-le-moteur-de-generation-de-pdf/1548/2 "2025-07-17T12:27:41Z")

</div>

Bonjour @Gauthier,

Un hook a déjà été ajouté dans Frappe (Dodock v4) pour que l’application Print Designer puisse imprimer avec Chrome ([feat: Chrome PDF Generator by maharshivpatel · Pull Request #399 · frappe/print\_designer · GitHub](https://github.com/frappe/print_designer/pull/399)). Il faut installer Print Designer pour pouvoir l’utiliser.  
Attention la configuration des formats d’impression via Print Designer ne fonctionne qu’avec Chromium/Google Chrome (Pas Firefox ou Safari, sinon ça _casse_ les formats d’impression).

Le sujet a l’air d’être sur la table depuis quelques temps côté Frappe, mais je ne sais pas du tout quand ça sera priorisé ([New print backend: puppeteer · Issue #25831 · frappe/frappe · GitHub](https://github.com/frappe/frappe/issues/25831)).

Sinon, pour le moment, la seule solution est de faire sa propre implémentation de moteur d’impression.

Quel type de problèmes rencontrez-vous avec wkhtmltopdf ?

---

<div class="post-metadata">

**Author:** ![Gauthier](https://community.dokos.io/user_avatar/community.dokos.io/gauthier/32/1616_2.png) [@Gauthier](https://community.dokos.io/u/Gauthier)\
**Post date:** [Juillet 18, 2025, 1:18 UTC](https://community.dokos.io/t/changer-le-moteur-de-generation-de-pdf/1548/3 "2025-07-18T13:18:07Z")

</div>

Bonjour Charles-Henri

Le souci c’est des sauts de pages entre les lignes d’un tableau (malgré qu’on ait coché l’option dans les paramètres d’impression et des essais de css personnalisé)

Merci, j’ai ajouté print designer et activé l’impression avec chrome  
Ca a corrigé nos problèmes de saut de page mais en voulant envoyer un email pour tester on a cette erreur pour l’instant

> <https://github.com/frappe/print_designer/issues/458>
>
> \*\*Description:\*\*
> 
> We're using the latest \`develop\` branch of Frappe and \`print\_d…esigner\` with the new \*\*Chrome PDF Generator\*\* as the backend (set via the Print Format configuration).
> 
> When sending a Sales Invoice via email with “Attach Print” enabled, the system fails with a \`RuntimeError: object is not bound\`. This happens specifically when the PDF is being generated using the Chrome backend.
> 
> \*\*Stacktrace Summary:\*\*
> 
> \`\`\`text
> RuntimeError: object is not bound
> 
> Traceback:
> File ".../frappe/email/doctype/email\_queue/email\_queue.py", line 398, in include\_attachments
> print\_format\_file = frappe.attach\_print(\*\*attachment)
> 
> File ".../frappe/utils/print\_utils.py", line 77, in get\_print
> pdf = frappe.call(...)
> 
> File ".../print\_designer/pdf\_generator/browser.py", line 416, in \_open\_header\_footer\_pages
> self.footer\_page.set\_tab\_url(frappe.request.host\_url)
> 
> File ".../werkzeug/local.py", line 501, in \_get\_current\_object
> raise RuntimeError(unbound\_message) from None
> \`\`\`
> 
> \*\*Analysis:\*\*
> 
> Looks like \`frappe.request\` is being accessed in a background job (email queue processing), where the request context is not available. This is not safe outside web request contexts. Specifically:
> 
> \`\`\`python
> self.footer\_page.set\_tab\_url(frappe.request.host\_url)
> \`\`\`
> 
> This line is trying to access \`frappe.request.host\_url\` inside the \`Browser\` class when generating the header/footer, but \`frappe.request\` doesn’t exist in a non-request context like a background job.
> 
> \*\*Steps to Reproduce:\*\*
> 
> 1. Create a Print Format and set PDF Generator to "chrome".
> 2. Enable header/footer (footer used in my case).
> 3. Send a Sales Invoice using Email with "Attach Print" checked.
> 4. Error occurs and email fails to send.
> 
> \*\*Environment:\*\*
> \* Frappe version: 15.71.0 (version-15)
> \* ERPNext version: 15.65.2 (version-15)
> \* Print Designer version: 1.x.x-develop (develop)
> 
> 
> \`\`\`
> Traceback (most recent call last):
> File "apps/frappe/frappe/email/queue.py", line 150, in flush
> email\_queue.send()
> 
> File "apps/frappe/frappe/email/doctype/email\_queue/email\_queue.py", line 173, in send
> message = ctx.build\_message(recipient.recipient)
> 
> File "apps/frappe/frappe/email/doctype/email\_queue/email\_queue.py", line 321, in build\_message
> message = self.include\_attachments(message)
> 
> File "apps/frappe/frappe/email/doctype/email\_queue/email\_queue.py", line 398, in include\_attachments
> print\_format\_file = frappe.attach\_print(\*\*attachment)
> 
> File "apps/frappe/frappe/\_\_init\_\_.py", line 2165, in attach\_print
> else get\_print(doctype, name, \*\*kwargs)
> 
> File "apps/frappe/frappe/utils/print\_utils.py", line 77, in get\_print
> pdf = frappe.call(...)
> 
> File "apps/frappe/frappe/\_\_init\_\_.py", line 1751, in call
> return fn(\*args, \*\*newargs)
> 
> File "apps/print\_designer/print\_designer/pdf.py", line 146, in wrapper
> result = func(\*args, \*\*kwargs)
> 
> File "apps/print\_designer/print\_designer/pdf\_generator/pdf.py", line 43, in get\_pdf
> browser = Browser(generator, print\_format, html, options)
> 
> File "apps/print\_designer/print\_designer/pdf\_generator/browser.py", line 29, in \_\_init\_\_
> self.prepare\_header\_footer()
> 
> File "apps/print\_designer/print\_designer/pdf\_generator/browser.py", line 133, in prepare\_header\_footer
> self.\_open\_header\_footer\_pages()
> 
> File "apps/print\_designer/print\_designer/pdf\_generator/browser.py", line 416, in \_open\_header\_footer\_pages
> self.footer\_page.set\_tab\_url(frappe.request.host\_url)
> 
> File "env/lib64/python3.12/site-packages/werkzeug/local.py", line 501, in \_get\_current\_object
> raise RuntimeError('object is not bound') from None
> 
> RuntimeError: object is not bound
> \`\`\`

En attente d’un correctif de leur part du coup

---

<div class="post-metadata">

**Author:** ![corentin](https://community.dokos.io/user_avatar/community.dokos.io/corentin/32/305_2.png) [@corentin](https://community.dokos.io/u/corentin)\
**Post date:** [Juillet 18, 2025, 1:47 UTC](https://community.dokos.io/t/changer-le-moteur-de-generation-de-pdf/1548/4 "2025-07-18T13:47:59Z")

</div>

> [@Gauthier](#):
>
> En attente d’un correctif de leur part du coup

Effectivement il y a un bug dans le cas d’un envoi d’email (ou d’une autre opération en tâche de fond). C’était plutôt simple à régler donc j’ai proposé un correctif, il ne reste qu’à attendre qu’ils l’appliquent :

> <https://github.com/frappe/print_designer/pull/464>
>
> closes #458 and #456

Corentin
