VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: darkidas on September 16, 2013, 18:20:40 PM

Title: Pdf invoice in greek language is broken
Post by: darkidas on September 16, 2013, 18:20:40 PM
Hi,
I am using Virtuemart 2.0.22d/joomla 2.5.14.
I have installed the greek language and when someone who uses the greek language make an order, the invoice pdf that is sent by email and also the pdf invoice in the backend are unreadable.
Instead of characters they are full of ?.
I guess it has to do with encoding. Any ideas on how to fix this?
Thank you in advance
Title: Re: Pdf invoice in greek language is broken
Post by: Maxim Pishnyak on September 16, 2013, 18:28:31 PM
Check FAQs forum section - thread "UTF-8 support in PDF Invoice".
Title: Re: Pdf invoice in greek language is broken
Post by: darkidas on September 16, 2013, 21:20:50 PM
Thanks for the reply,
I have already tried that fix but nothing happened. Tried it again same result. Also the section that Bytelord suggests to change is not there. Maybe this solution is for an older vm version than mine.
Any other suggestions would be appreciated
Title: Re: Pdf invoice in greek language is broken
Post by: Maxim Pishnyak on September 17, 2013, 09:38:22 AM
What did you try to do? I saw two possible solutions for this issue.
Title: Re: Pdf invoice in greek language is broken
Post by: darkidas on September 17, 2013, 17:16:15 PM
I have tried this:

Quote1. Download tcpdf from this link http://sourceforge.net/projects/tcpdf/
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';

but it didnt work. I also replaced freesans with dejavusans. It didnt work either.

The suggestion of bytelord :
QuoteWhen 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);
I didnt find those lines of code in the file indicated.
Title: Re: Pdf invoice in greek language is broken
Post by: Maxim Pishnyak on September 17, 2013, 19:34:54 PM
I'm not sure maybe it's possible to choose font in invoice setup (VM Vendor config)?
Title: Re: Pdf invoice in greek language is broken
Post by: darkidas on September 18, 2013, 16:07:01 PM
Hmm using a unicode font from inside vm config as you suggested helped a lot. I at least got rid of the annoying ? . The core text is not translated though its in english and only user input is shown at greek. But for now i am ok with that  :)
Thanks for your help and lets hope i will not need you again on that subject.
Title: Re: Pdf invoice in greek language is broken
Post by: Maxim Pishnyak on September 18, 2013, 19:43:25 PM
It's ok. You're welcome.