News:

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

Main Menu

japanese character in invoice PDF

Started by dbcig2013, December 22, 2013, 14:56:23 PM

Previous topic - Next topic

dbcig2013

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]

jjk

#1
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');
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

dbcig2013

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

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


jjk

Maybe the freesans font also has to be added into the folder yourdomain/libraries/tcpdf/fonts
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

dbcig2013

#4
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

david

jjk

Ok, sorry. I've overlooked that the description already includes adding the font to the tcpdf folder
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

dbcig2013

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

jjk

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]
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

dbcig2013

yes, i retried after cleared the joomla cache, purged jommla expired files and cleared my browser!

dbcig2013



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]

reinhold

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