Author Topic: Question Marks on PDF Invoice  (Read 3513 times)

WebWorx

  • Beginner
  • *
  • Posts: 7
Question Marks on PDF Invoice
« on: November 14, 2013, 07:19:48 am »
I have a site that is in Hebrew... at least the front end is... (the backend and install was in English as I live in the US) and everything is working fine... except when the PDF invoice is created... it's pretty much loaded with question marks everywhere where it should say stuff like Name, Address, etc... (that should be in Hebrew not English or Question Marks) except for the client's info, which is correct on the PDF file.

I am running:
Joomla 2.5.14   VM 2.0.24     PHP 5.3.27   

I am thinking its because some of the Hebrew characters are throwing off the code/tags during invoice creation... ie. some of the Hebrew characters are coding characters too.

On a side note and I dont think has anything to do with the issue and I fear putting it in as it may sidetrack the thinking process but: It this site is not considered a multi language site in virtuemart... In configuration --> shop I have just English in the Multilingual shop parameters in the Language settings. I tried to put Hebrew but the site didnt work right for some reason so I left it as English and it works fine. I do have Use English as fallback for untranslated strings checked.

In the Extensions - Language Manager setting I have Hebrew as the default. Virtumart seems to be using the Hebrew language pack language files I put in for virtuemart... the entire site works and is in hebrew except for the invoice that is created.

I saw the solution on this page... which describes a problem like I was having: http://forum.virtuemart.net/index.php?topic=99783.0 
although that solution I think is of a earlier version of VM 2.

I did the following which that potential solution said to do:
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';

and it didnt' work. Although there was no fonts.php in that folder location - there was pdf.php file which had that code in the same line areas so I figured it was just a renamed file and I made the edits on the pdf.php file.

Then I tried this: or was going to try it but the code is no where on that invoice.php file

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);


Please help - thanks.

PS - I didn't want to put the site link up for various reasons and I hope I provided enough info for suggestions.


jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3486
  • using Matomo instead of Google Analytics
Re: Question Marks on PDF Invoice
« Reply #1 on: November 14, 2013, 10:07:55 am »
I'm not sure, but I suppose you have to do two things:

1. In the file ...your-root-folder\libraries\tcpdf\tcpdf.php, approximately line 2003, probably '$this->rtl = false'  has to be set to true. I don't know what the line below that does, but it seems to be related to rtl languages, too.

2. Install a font like http://dejavu-fonts.org/wiki/Main_Page into the tcpdf font folder. Don't know if this needs to be set as a default font then.

Maybe somebody in the tcpdf forum knows what is required in your case. I think there are a few hebrew shops in this forum section: http://forum.virtuemart.net/index.php?board=11.0
Maybe somebody who is running a hebrew VM shop already can help.

Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9856
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Question Marks on PDF Invoice
« Reply #2 on: November 14, 2013, 10:16:36 am »
The israelian community asked me, why we do not have any rtl support already in vm2. My answer was that no one donated this yet. So if you can help us with this....
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

WebWorx

  • Beginner
  • *
  • Posts: 7
Re: Question Marks on PDF Invoice
« Reply #3 on: November 14, 2013, 21:38:03 pm »
I hear ya Milbo... but I dont think my specific issue has to do with the RTL thing... I got the site to be RTL through CSS work and setting the site's language to Hebrew... my specific issue has to do with the characters I think... I have seen others who's sites are in various languages that are a lot different than English, German, Spanish, etc... like Japanese - complain about this issue too... and the link above that I provided with the (old) solution makes sense and appears to work (for the older version)... but the files they referenced have since updated. Any help with my specific issue? thanks

WebWorx

  • Beginner
  • *
  • Posts: 7
Re: Question Marks on PDF Invoice
« Reply #4 on: November 14, 2013, 21:45:09 pm »
JJK - I can't find a tcpdf forum? Do you have a link for them?

stAn99

  • Contributing Developer
  • Jr. Member
  • *
  • Posts: 81
    • One Page Checkout for Virtuemart 2
Re: Question Marks on PDF Invoice
« Reply #5 on: September 22, 2014, 14:40:07 pm »
hello, the problem is caused by a missing font withint the tcpdf library. You should search for "create font for tcpdf" or start from this link:

http://www.tcpdf.org/fonts.php

if you decide to use windows's TTF, make sure that:
- it has proper code page which you need
- check licensing of the TTF fonts

most google fonts do not include other than EN encoding, so you may need to buy another one. The basic TCPDF library usually comes only with EN codepages as far as i know.

Best regards, Stan


----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart