When the invoice is created the characters that are included are questionmarks
It is supposed to be in greek language.
(http://www.trazeras.gr/pdf.png)
Can anyone help?
Hi,
unfortunatelly this is problem of TCPDF and fonts it uses by default.
Good discussion is on stack overflow, other usefull links:
http://stackoverflow.com/questions/5333702/tcpdf-utf-8-problem
http://www.tcpdf.org/fonts.php
I had similar problem with czech characters, the only solution now is to modify \libraries\joomla\document\pdf\pdf.php and add some UTF8 font to embed him in pdf.
$pdf->SetFont('freesans');
You also need to download tcpdf from sourceforge, unpack current version and copy fonts directory from archive to joomla.
freesans should be unicode, but your PDF documents will grow by approx 700kb :(
But you can play with fonts or make your own subset...
Hope this helps, at least it clarifies some tricky pages of tcpdf...
Ondra
just thought it might also be useful to have a look at the mbstring settings with phpinfo and eventually try to adjust them.
See here: http://php.net/manual/en/mbstring.configuration.php (http://php.net/manual/en/mbstring.configuration.php)
The next link is pretty old, but it might contain a few hints on how to solve your problem, escpecially in the comments below that article.
http://developer.loftdigital.com/blog/php-utf-8-cheatsheet (http://developer.loftdigital.com/blog/php-utf-8-cheatsheet)
Thanks guys for you replies..
I achieved to resolve my problem following ondrejspilka instructions..
I will write the steps that I followed in a more clear way so that everyone can do the changes..
1. 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';
Everything is OK now...
Sofoklis
Hi! Just solved my problem in the same way - wanted to post solution, but saw that You've already cracked it. :) So - simply must agree. Solution above works!
Thank you Sofokli!
It works great!
You are gamatos! ;)
Fotis.
Guys, I'm stuck here..
I made all the above changes, my pdfs generated in the back end look fine, but the attached to the order invoices are still messed up.
What gives?
Thanx in advance.
Joomla: 2.5.7
Virtuemart 2: 2.0.12
PHP: v5.3.3
Hi,
What exactly is messed up? The utf8 characters or someting else? What's the language your are using for your pdf's?
The same library generates ALL the pdf, so it should be a utf issue.
Regards
I am encoding greek fonts.
Upon investigation, I noticed that the attached to mails pdf DOES NOT have embedded the fonts, whereas the popped up from the back end invoice does. They do have about 70K difference in size so that confirms it. Have a look at the two generated files.
Non-embedded
(http://i.imgur.com/Yp2Nd.jpg)
Embedded
(http://i.imgur.com/qkQom.jpg)
My option is set to false, meaning embedding should be active.
pdf.php:
$pdf->SetFont('freesans', '', 6, '', 'false');
hello,
did you download the fonts from tcpdf?
Is working for me with greek enabled also.
Regards
Yes, I followed the instructions carefully, before the fix both generated pdfs were rubbish, now the backend ones are fine but the attached to mails are as they used to be, full of question marks.
Hi,
You could examine the core code to see how is calling the tcpdf function for creating the attached pdf's. may be change's the font.
i will give a try also
Regards
ok, a little bit delay but is resolved.
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);
Sorry for taking to long to respond but i was thinking that this was working, find it today while upgrading a live site. So each time you upgrade vm2 you have to change also that lines!
Regards
Thanks a lot mate, I had given up to be honest...
I will make the changes and report results, although I'm positive you nailed it...
Cheers!
PS: How long before text verification for every single post stops in this forum? :P
Hi,
Yes, test it and post the results. The difference is that view\pdf\view.pdf.php that produces the PDF in the front-end does not set fonts, so default fonts from tcpdf library are used. In the backend the font are been reset so was using the default one ...
Btw, the default fonts for tcpdf are dejavusans, the vm developers have change them, probably to reduce the pdf file size.
PS: Not sure, i think after 7-15 posts ... something like that ...
Regards
Thanks again, tonight for some reason my net speeds are very slow and it's a pain to perform more tests, I did two test orders and I got NO pdf attached to mails and, to add insult to injury, my backend generated pdfs from the order list are now messed up as well (the usual question marks). I will look into that tomorrow, I have to clean caches, chown some files (I edit as root sometimes for speed along many sites and some folders are sensitive to ownership) and re-run the tests, on top of all that I have upgraded vm versions since posting the first post and I can't know if something else is causing this..
I will update tomorrow after making everything is as it should..
Try with dejavusans both in vm admin and tcpdf
joomla_folder\components\com_virtuemart\controller\invoice.php around lines 151, 152 change the font
$pdf->setHeaderFont(Array('dejavusans', '', 8 ));
$pdf->setFooterFont(Array('dejavusans', '', 10 ));
also around line 179, change also the font
$pdf->SetFont('dejavusans', '', 8, '', true);
------
libraries\joomla\document\pdf\pdf.php around lines 32 and 33
var $_header_font = 'dejavusans';
var $_footer_font = 'dejavusans';
around line 222
$pdf->SetFont('dejavusans', '', 8, '', 'false');
Regards
Ok, I made all the above changes and my backend generated pdfs are once again OK, I still don't get attached pdfs Ι'm afraid during the last update some root-owned files (my bad) were not updated, I will wait for the next update which will happen after a chown -R and try again. I don't think there are other places to look into, those two files are where the problem is (one for the email attachments and one for the back end), but I will post as soon as I have a solid set of files by version.
Ok FIXED.
I had to change the "statuses to send invoice" in configuration they were empty for some reason.
The attached pdf was as it should, perfectly readable.
Thanks a lot for your help Bytelord!!
problem after update to 2.0.22b
before update everything worked fine, after update same situation instead UTF8 characters i have "?" ... any solution ?
Same here with a new site for a client, the documents have changed, I can't even find the same fields...
Shop>invoices now has a default font selection menu but I have no available fonts to choose...
Must be here, in vmpdf.php, so if I could set it in the front end it should work..
$vmFont=$this->vendor->vendor_letter_font;
$this->SetFont($vmFont, '', $this->vendor->vendor_letter_font_size, '', 'false');
$this->setHeaderFont(Array($vmFont, '', $this->vendor->vendor_letter_header_font_size ));
$this->setFooterFont(Array($vmFont, '', $this->vendor->vendor_letter_footer_font_size ));
OK, fixed it.
After I messed it up beyond hope, I re-installed the newest component, then aio, then updated the tables. Magically, after all that, I had a UTF-8 font on the drop down menu on the backend, which, when selected, worked as it should, both front and back end.
Hello,
downloaded fonts, changed pdf.php as described but my Lithuanian text in PDF is still with ?? characters when pressing in back end.
And I can't find fonts line in file \components\com_virtuemart\controller\invoice.php so maybe this is the problem ?
Using 2.0.22x version of virtuemart.
Any one :) ?
Did anyone get this method to work on the newer version of VM? I am having problems with the PDF invoice and Hebrew... getting question marks to come up where it should say (in Hebrew) Name, Address, Date, City, State, etc. the data for the customer - ie. the actual name, address is in there but just the labels show up as ????.... I posted my issue here... and I tried the suggestions I have found on these threads with no success.... Here is the thread with more info - http://forum.virtuemart.net/index.php?topic=120243.msg409539#msg409539
hi,
in my case ( japanese character) , this workaround does not work.
i correctly loaded the freesans font in joomla library, but it seems the modification of pdf.php ( /libraries/joomla/document/pdf/) and invoice.php (components\com_virtuemart\controller\invoice.php) do not change the font in generated pdf file
if i have a look in the properties of generated invoice, the default font is not freesans as it should
nb: fonts.php does not exist. instead i have pdf.php
Quote from: dbcig2013 on December 22, 2013, 14:16:12 PM
hi,
in my case ( japanese character) , this workaround does not work.
i correctly loaded the freesans font in joomla library, but it seems the modification of pdf.php ( /libraries/joomla/document/pdf/) and invoice.php (components\com_virtuemart\controller\invoice.php) do not change the font in generated pdf file
if i have a look in the properties of generated invoice, the default font is not freesans as it should
nb: fonts.php does not exist. instead i have pdf.php
[attachment cleanup by admin]
It works Great for me too.
Greek Characters
Joomla 2.5.24
VM 2.6.6
The only difference is that the file is pdf.php
Thanks a lot
i tried a lot of times with the changes but i was still getting the question marks ??
i solved it by doing the most easy step , delete the invoices in the safe path and
i finally get to see greek characters.
Joomla 2.5.25
VM 2.6.6
Quote from: tzaris on September 23, 2014, 21:47:50 PM
i tried a lot of times with the changes but i was still getting the question marks ??
i solved it by doing the most easy step , delete the invoices in the safe path and
i finally get to see greek characters.
Joomla 2.5.25
VM 2.6.6
Good for you. I've been having this issue for a long time now and tried getting a solution for it awhile back but failed. Tried following every fix in this thread including deleting the invoices (though I was a bit hesitant at first but decided to since i had no other options left) but still not seeing any results. Do you guys have any other links to help me out on this? Much appreciate any help.
I have tried everything in this thread. after changing invoice font frmo VM backend to UTF-8, it now shows a "square box" instead of the earlier "?"
font changed to "dejavusans"
where am I wrong?
Joomla 2.5.22
VM: 2.6
Quote from: TheHostDogs on March 18, 2012, 19:39:46 PM
Thanks guys for you replies..
I achieved to resolve my problem following ondrejspilka instructions..
I will write the steps that I followed in a more clear way so that everyone can do the changes..
1. 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';
Everything is OK now...
Sofoklis
Hi!
To Russian and Ukrainian languages picked fonts:
Open file \libraries\joomla\document\pdf\pdf.php
find and change to
var $_header_font = 'dejavusans';
var $_footer_font = 'dejavusans';
$pdf->SetFont('dejavusanscondensed', '', 8, '', 'false');
Joomla 3.4.1 + VM 3.0.6.4
Actually I wonder why this hack is still necessary. There is an option in vendor pdf tab for the font, which affects also the header and footer font
$vmFont=$this->vendor->vendor_letter_font;
$this->SetFont($vmFont, '', $this->vendor->vendor_letter_font_size, '', 'false');
$this->setHeaderFont(Array($vmFont, '', $this->vendor->vendor_letter_header_font_size ));
$this->setFooterFont(Array($vmFont, '', $this->vendor->vendor_letter_footer_font_size ));
So maybe you hunt ghosts?
Help me please!
In which file or in which tabs "Configuration" I should write this code?
You dont need to write any code. Open your shop config (not vm config) and edit the invoice settings there.
Okay! For invoices - select the font: Virtuemart->Shop->tab Invoices/Emails -> Default Font = Free Mono (UTF-8 Unicode)
But only this hack (written above) helps when you export the item description in pdf.
May be you have other variant for export in pdf?
Again, I am on Joomla 2.5.28 & VM 2.6 and I am clueless what I am doing wrong !!
Tried everything. Seems there is no solution to this? :(
What you do wrong is to read an old thread
"March 09, 2012" , this means that almost anything here is outdated. The problem is solved in vm2.6 and vm3. It is very likely that you have another problem.
any suggestions on what I can try to set this right?
Quote from: Milbo on March 30, 2015, 02:47:52 AM
Actually I wonder why this hack is still necessary. There is an option in vendor pdf tab for the font, which affects also the header and footer font
$vmFont=$this->vendor->vendor_letter_font;
$this->SetFont($vmFont, '', $this->vendor->vendor_letter_font_size, '', 'false');
$this->setHeaderFont(Array($vmFont, '', $this->vendor->vendor_letter_header_font_size ));
$this->setFooterFont(Array($vmFont, '', $this->vendor->vendor_letter_footer_font_size ));
So maybe you hunt ghosts?
Hello, if I open shop settings->Invoice tab->appearance->default fonts there is no fonts, only Select an Option. Any idea how can I add fonts?
When you updated all the time, you may did not get the fonts. download the last tcpdf installer http://dev.virtuemart.net/projects/tcpdf/files
Hi all, does any one get solution for this?
I'm using Joomla 3x and VM3, I tried:
1. Change pdf.php setfont
2. Change default font via backend
3. Clear safe path invoice
But traditional chinese character not showing up still. Hope to get solution. Thanks!
It works Great for me too.
Greek Characters
Joomla 3.9.16
VM 3.6.10 10211
Thanks a lot