News:

Looking for documentation? Take a look on our wiki

Main Menu

VM 3.0.16 :: Chinese ZH-TW in pdf invoice

Started by WilfredP, August 02, 2016, 12:41:32 PM

Previous topic - Next topic

WilfredP

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.

jjk

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

WilfredP

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.

icjacky


thepet

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
Hartmut - thepet

jjk

Which encoding do you have selected in your browser when viewing chinese text?
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

thepet

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
Hartmut - thepet

jjk

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

thepet

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?

Hartmut - thepet

jjk

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

thepet

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....

Hartmut - thepet

thepet

#11
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
Hartmut - thepet