PDF invoice plugin 4.1.3 — logo not rendered with the default invoice layout

  • Posts: 262
  • Thank you received: 9
1 hour 9 minutes ago #373311

Hello,

The store logo renders correctly with flat_invoice and corporate_invoice, but shows as a pink placeholder box with the default invoice layout.

Environment: HikaShop Business 6.5.2, PDF invoice plugin 4.1.3, Joomla 5.4.8, PHP 8.2.

The cause is the quoting of the src attribute. In invoice.php:

php
<img src="<?php echo $image_address_path; ?>" style="<?php echo $img_style; ?>">

flat_invoice.php and corporate_invoice.php use single quotes instead:

php
<img src='<?php echo $image_address_path; ?>' style='<?php echo $img_style; ?>'>

_preprocessImages() correctly replaces the URL with the local temp file path, but something afterwards — hikashop_absoluteURL() or the rendering — only handles the single-quoted form. With double quotes, the final HTML sent to html2pdf contains:

html
<img src=" www.lact.fr/home/lact/htdocs/lact.fr/tmp/hk_inv_img_kFPdBu.png " ...>

The site domain prepended to an absolute filesystem path. With single quotes, the same code produces the correct src='/home/lact/htdocs/lact.fr/tmp/hk_inv_img_lWUWzU.png' and the logo appears.

Switching to single quotes in our layout override fixed it. It looks like invoice.php just needs the same quoting as the other layouts.

Two side notes while testing:

The security hardening in spipu/html2pdf rejects any remote path because the allowed hosts list is never populated — we had to add $html2pdf->getSecurityService()->addAllowedHost(...) after the Html2Pdf instantiation to get past Unauthorized path host.

_preprocessImages() leaves the zero-byte stub created by tempnam() behind, since the shutdown function unlinks $tmp . '.png' rather than $tmp. Minor, but they accumulate.

Please Log in or Create an account to join the conversation.

Time to create page: 0.052 seconds
Powered by Kunena Forum