Wrong caracters in attachinvoice

  • Posts: 8
  • Thank you received: 2
1 year 4 months ago #353624

-- Joomla version -- : 4.3.3
-- PHP version -- : 8.1.16
-- Browser(s) name and version -- : any browser
-- Error-message(debug-mod must be tuned on) -- : no errors

I use attachinvoice in polish. The polish specific characters are not display - there are question marks in place of them.
For example, in the default Layout, you have the example in attachments.

In the Corporate layout the first of the attachments is ok, the second one still wrong.

Attachments:
Last edit: 1 year 4 months ago by Bone.
The following user(s) said Thank You: ssnobben

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 4 months ago #353629

Hi,

This means that the font used by the plugin to generate the PDF doesn't support the characters. You need to use another font in the settings of the plugin in the Joomla plugins manager.

The following user(s) said Thank You: ssnobben

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

  • Posts: 8
  • Thank you received: 2
1 year 3 months ago #353640

I will try to change it.
But, I expect that the default settings work in an acceptable way.

Last edit: 1 year 3 months ago by Bone.

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

  • Posts: 8
  • Thank you received: 2
1 year 3 months ago #353644

I have tested it.
Unfortunately, the chosen font is NOT used for the footer. So in the footer all the time question marks

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 3 months ago #353649

Hi,

Unfortunately, we didn't find a font which works for any UTF8 character and the library we use to convert the HTML of the invoice into a PDF doesn't provide that. We already added several fonts to improve the compatibility with some characters.

Regarding the issue with the footer, I was indeed able to reproduce the issue on my end. It's actually a bug which is in the library we're using to convert the HTML of the invoice into a PDF. It was reported years ago here:
github.com/spipu/html2pdf/pull/2
I've replied there with some indications to simply reproduce the problem. Hopefully, someone knowing the inner workings of the library can provide a long term solution.
In the mean time, what you can do is to open the file plugins/hikashop/attachinvoice/vendor/spipu/html2pdf/src/config/tcpdf.config.php and change "helvetica" in the line:

define('PDF_FONT_NAME_MAIN', 'helvetica');
to the font you've selected in the font setting of the plugin so that it will use the same one for the footer.

The following user(s) said Thank You: ssnobben

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

  • Posts: 8
  • Thank you received: 2
1 year 3 months ago #353667

This solution does not work in my case. In place of question marks, I have now empty spaces. In the main part there is everything ok.
Try, maybe on your site, set the footer to:
Zażółć gęślą jaźń
for testing multiple (polish) characters

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 3 months ago #353669

I tried that, with the font "kozgopromedium" selected in the plugin and I'm able to get the footer to display after changing the code in the plugins/hikashop/attachinvoice/vendor/spipu/html2pdf/src/config/tcpdf.config.php file to use kozgopromedium
Can you make sure you did the modification for PDF_FONT_NAME_MAIN and not for PDF_FONT_NAME_DATA ?
Are you using the same font or another one ?

The following user(s) said Thank You: ssnobben

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

  • Posts: 8
  • Thank you received: 2
1 year 3 months ago #353677

Thank you. It works, but the text does not look well - additional spaces.
I will just edit your template and move the footer to an ordinary div

The following user(s) said Thank You: ssnobben

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

Time to create page: 0.045 seconds
Powered by Kunena Forum