VirtueMart Forum

VirtueMart 2 + 3 + 4 => Language/Translations => Topic started by: WilfredP on August 02, 2016, 12:41:32 PM

Title: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: WilfredP on August 02, 2016, 12:41:32 PM
Hi all,

Website:
Joomla 3.6
VM 3.0.16
TCPDF 1.0.2
Language ZH-TW

I have problem where my pdf invoice showing question marks, chinese character not showing properly. I have set default font to UTF-8, also what solution provided in forum few yrs ago to change the tcpdf setfont code. However nothing is work at the moment I write this post, wish to get someone to assist. Appreciate and thank you.
Title: Re: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: jjk on August 02, 2016, 20:40:41 PM
Does this help?
http://forum.virtuemart.net/index.php?topic=111716.msg375672#msg375672
Title: Re: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: WilfredP on August 03, 2016, 06:04:49 AM
Quote from: jjk on August 02, 2016, 20:40:41 PM
Does this help?
http://forum.virtuemart.net/index.php?topic=111716.msg375672#msg375672


Hi jjk, thanks for your reply. Yes, I did try with few fonts, the only changes was the character from ???? to ????? in square frame.
Title: Re: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: icjacky on August 23, 2016, 13:16:26 PM
i had the same problem with u.
Title: Re: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: thepet on November 29, 2016, 20:31:16 PM
Hi there,

Joomla 3.6.4
Virtuemart 3.0.18
php: 5.3  (tried also 5.7)

I've the same problem, but unfortunately all tipps didn't work for me.

I have only ?????? instead of chines characters.

I also cannot find a font.php under joomla/document/pdf. There is only a pdf.php.

Does anybody have anothe idea?

Best Regards
Hartmut
Title: Re: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: jjk on November 29, 2016, 22:12:54 PM
Which encoding do you have selected in your browser when viewing chinese text?
Title: Re: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: thepet on November 30, 2016, 07:14:21 AM
Hi jjk,

thanks for reply.

I'm using UTF-8.

It is not the problem with showing a website in chinese, only the .pdf aren't readable. These are opened with Acrobat DC.

I thinks it's a problem during creation. I couldn't find any further solution yet.

Actually, this is a desaster, the shop is ready to be launched, for chinese market and invoicing is impossible  :(

Hope to have some hints

Best Regards
Title: Re: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: jjk on November 30, 2016, 11:04:16 AM
The pdf invoices are generated by the tcpdf library, which converts html output into pdf. I would suggest to try (add) different fonts to the tcpdf library at your-joomla-root-folder\libraries\tcpdf\fonts. For example: https://github.com/overblog/tcpdf/blob/master/fonts/stsongstdlight.php or https://github.com/overblog/tcpdf/blob/master/fonts/cid0cs.php are simplified chinese fonts.

Probably you will also need to change the default font in VM administration at 'Shop' > 'Invoices/Emails' > Appearance > Default font.

Not sure if this helps...  ;)
Title: Re: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: thepet on November 30, 2016, 14:20:12 PM
Hi jjk,

QuoteProbably you will also need to change the default font in VM administration at 'Shop' > 'Invoices/Emails' > Appearance > Default font.

This gives me only three selections and I would assume that "Free Mono (UTF-8 Unicode)" should be the correct one, right?

At least after I changed from "Helvetica (Base Font)" the appearance changed already from "?" only to "?" within a square :-)

Is there an option to have more selection there?

Title: Re: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: jjk on November 30, 2016, 17:49:22 PM
I guess you would have to experiment with adding a simplified chinese font to the tcpdf font library and get it to be selectable in the VM adminstration.
See here: https://forum.virtuemart.net/index.php?topic=121107.msg413182#msg413182
Title: Re: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: thepet on December 01, 2016, 14:05:46 PM
Hi jjk,

fonts I could add to tcpdf library, but the list of selectable fonts is unreachable for me, as the reference made by reinhold is obviously not applicable for 3.0.18 anymore.

Also, what is very strange to me is, that dbcig2013 (topic starter of that topic) seems to be right, changed in the pdf.php seem to have no effect at all, even renaming of that file doesnt lead to any disturbance.
I also cannot find any other reference which may leads to this pdf.php. Seems it is superfluid :-)

Anyhow, back to my problem: Do you have any idea where I can change the selectable fonts in Virtumart Administration?

For me it is a big problem now, it is impossible to launch this shop without having the possibility to issue chinese invoices and I'm getting nervous....

Title: Re: VM 3.0.16 :: Chinese ZH-TW in pdf invoice
Post by: thepet on December 01, 2016, 15:20:26 PM
Hi jjk and @all others,

QuoteProbably you will also need to change the default font in VM administration at 'Shop' > 'Invoices/Emails' > Appearance > Default font.

That was the right kick..., I only didn't know, where, as mentioned in my previous post...

BUT THEN I GOT IT! :)

As mentioned below, add the fonts to the TCPDF-library ./libraries/tcpdf/fonts:
I added arialuni (arialuni.ctg.z, arialuni.z, arialuni.php and droidsansfallback.ctg.z, droidsansfallback.z, droidsansfallback.php)
Then I created the respective .xml-files (arialuni.xml and droidsansfallback.xml). Just make logical alterations to one of the existing .xml of another font.
Then I referred to the /administrator/components/com_virtuemart/models/config.php at line 149, where it is specified that the list of available fonts in backend of Virtuemart (SHOP>>Invoice/Emails) depends on:
Quote$manual = array('courier_specs.xml','freemono_specs.xml','helvetica_specs.xml');
and created the respective _specs.xml files for arialuni and droidsansfallback. Also here I just made logical amendments to the existing helvetica_specs.xml and thats it.

I did not even add the expression "droidsansfallback_specs.xml and arialuni_specs.xml" into that line 149, so no core hack at this part!

With the aid of the droidsansfallback_specs.xml within the "fonts" folder of TCPDF I could select in the Virtuemart Admin panel (Shop/Invoices Emails) this font.
This is the font where the vmpdf.php (./components/com_virtuemart/helpers/vmpdf.php) refers to in line 142 onwards (I think)

Then I got the correct display of Chinese Traditional characters.

I then tested it to change the font in the ./libraries/joomla/dcdument/pdf/pdf.php but this didn't change anything anymore...

I do hope this may helps one or another...  :D