You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

[SOLVED] UTF-8 support in PDF Invoice

Started by Artanis, March 18, 2012, 19:09:37 PM

Previous topic - Next topic


[The whole thread is completly outdated, anything is now implemented as options]


I have problem with PDF generatinon functionality in VM2. In my native Latvian language there are some non-latin symbols (e.g. "āūšļķž"), and some products in my shop have russian names using crylic (e.g. "название"), and when it comes to PDF invoice generation functionality in VM2, there are question marks "?" instead of these symbols in text. It's kind of not SO big deal, but it's still looks very unprofessional and crappy, and I'd like to correct this.

So, the question is - what can I do to correct PDF generation process to support UTF-8 characters? Add some kind of other fonts? Correct generation script? What?

EDIT: After googling a bit more, I think I found the solution. I'll check this out and notify here.

Thanks in advance, guys. I appreciate any help.
Best regards, Arthur.
Animus Project - Design Studio
Running Joomla 2.5.6, Virtuemart 2.0.6a, PHP 5.3.10


This solution worked for me like a charm - Latvian ar Russian crylic characters now are displayed well!

Quote from: TheHostDogs on March 18, 2012, 19:39:46 PM
1. Download tcpdf from this link
2. Take the fonts files included in the Fonts folder of the downloaded file and I copy them to the /libraries/tcpdf/fonts
3. Open /libraries/joomla/document/pdf/fonts.php and find the line where $pdf->SetFont is written (about line 221)
4. Replace the line with something like that $pdf->SetFont('freesans', '', 6, '', 'false');
5. Find "var $_header_font" and "var $_footer_font" (about lines 32 and 33) and replace the fonts there with freesans font:
   var $_header_font = 'freesans';
   var $_footer_font = 'freesans';

Maybe someone of administrators could pin this to FAQ? It's kind of must-have for non-english country users.
Animus Project - Design Studio
Running Joomla 2.5.6, Virtuemart 2.0.6a, PHP 5.3.10


Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum



When order status updated from the backend or pdf invoice saved in safepath, controller runs a function that set the fonts again. So edit the file joomla_folder\components\com_virtuemart\controller\invoice.php

around lines 151, 152 change the font

$pdf->setHeaderFont(Array('freesans', '', 8 ));
$pdf->setFooterFont(Array('freesans', '', 10 ));

also around line 179, change also the font

$pdf->SetFont('freesans', '', 8, '', true);

(Original post:

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!