VirtueMart Forum

VirtueMart 2 + 3 + 4 => Language/Translations => Topic started by: dbcig2013 on December 22, 2013, 14:56:23 PM

Title: japanese character in invoice PDF
Post by: dbcig2013 on December 22, 2013, 14:56:23 PM
hi,

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]
Title: Re: japanese character in invoice PDF
Post by: jjk on December 22, 2013, 22:14:03 PM
Quote from: dbcig2013 on December 22, 2013, 14:56:23 PM
nb: fonts.php does not exist. instead i have pdf.php
I suppose font.php was just a typo. I have the line which has to be changed in: yourdomain\libraries\joomla\document\pdf\pdf.php too.
line 222:       $pdf->SetFont('helvetica', '', 8, '', 'false');
Title: Re: japanese character in invoice PDF
Post by: dbcig2013 on December 23, 2013, 10:08:39 AM
yes it has already been done, as mentioned


everything indicated in the similar issue habe been followed without any succcess


http://forum.virtuemart.net/index.php?topic=99347.0 (http://forum.virtuemart.net/index.php?topic=99347.0)

It seems like if ,for another reason , the modifications i made was not apply !
Since the freesans font do not appear in the property of the downloaded invoice pdf file

Title: Re: japanese character in invoice PDF
Post by: jjk on December 23, 2013, 10:28:02 AM
Maybe the freesans font also has to be added into the folder yourdomain/libraries/tcpdf/fonts
Title: Re: japanese character in invoice PDF
Post by: dbcig2013 on December 23, 2013, 11:53:09 AM
As describe before, i done everything from  "thehostdog" member 

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 more

http://forum.virtuemart.net/index.php?topic=99347.0 (http://forum.virtuemart.net/index.php?topic=99347.0)

david
Title: Re: japanese character in invoice PDF
Post by: jjk on December 23, 2013, 12:26:28 PM
Ok, sorry. I've overlooked that the description already includes adding the font to the tcpdf folder
Title: Re: japanese character in invoice PDF
Post by: dbcig2013 on December 23, 2013, 13:08:15 PM
No pb!

I think there is something different in the new version of virtuemart.
to be sure, I rename the pdf.php file as it seems not to change anything

Oh surprise: without this file, the pdf invoice are generated as well.
=> So, i think we do not have to consider this file any more  to make any change in pdf invoice. the pb is somewhere else
Title: Re: japanese character in invoice PDF
Post by: jjk on December 23, 2013, 13:30:49 PM
Quote from: dbcig2013 on December 23, 2013, 13:08:15 PM
I think there is something different in the new version of virtuemart.
About a year ago a feature allowing to select the default font for the VM invoices was added. It is located in Shop > Invoices tab. See screenshot attached.
Quote
Oh surprise: without this file, the pdf invoice are generated as well.
Are you shure that all Joomla and your Browser cache were cleared after you disabled that file?

[attachment cleanup by admin]
Title: Re: japanese character in invoice PDF
Post by: dbcig2013 on December 23, 2013, 13:57:34 PM
yes, i retried after cleared the joomla cache, purged jommla expired files and cleared my browser!
Title: Re: japanese character in invoice PDF
Post by: dbcig2013 on December 23, 2013, 14:20:23 PM


I didn't think to this option in     Shop > Invoices tab.

You are probably right since, choosing an other kind of font change the appearence  ( sreenshot attached)
Nethertheless, the pdf.php as not been affected by this change in option . Witch would mean the pdf are generated by another php file ?

If i m able to add freesans font in the    Shop>invoice, i will probably solved my issue

a





[attachment cleanup by admin]
Title: Re: japanese character in invoice PDF
Post by: reinhold on December 23, 2013, 15:08:41 PM
VirtueMart uses its own TCPDF-derived class to create the PDFs. The corresponding file is components/com_virtuemart/helpers/vmpdf.php

The font is set (using the config option value) around lines 119-122.

The list of available fonts shown in the dropdown is created by the VirtueMartModelConfig::getTCPDFFontsList function (file administrator/components/com_virtuemart/models/config.php, starting line 106). That function directly creates the "<option>...</option>" HTML codes to be inserted in a HTML select field.
That detection function is far from perfect, and I have not really found a way to detect all installed fonts that can be used by TCPDF...

If anyone knows the correct way to detect which fonts for TCPDF are installed/available, I'm sure Milbo will happily accept a patch ;)

Reinhold