Changing PDF type to Unicode – is this possible?
-
Hi Ewout,
Thank you for this great plugin. I do have some issues which others might experience. Currently my country’s currency symbol is only supported via Unicode type. Is this the reason why my amounts have a box beside them in the PDF version? If so, how can we change the file type of the PDF to that of Unicode instead of ANSI? And if the first question is not possible, is there a way where we can truncate the currency symbol and just show the numbers instead? Thank you and more power!
https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/
-
Here’s a screenshot:
Hi Jake,
The plugin is not using ANSI but UTF-8. We did have some issues with special characters in the past, but AFAIK everything should work fine now. You didn’t mention your country or the currency symbol, so I’m unable to check if it works on my setup. Do you see any red or orange warnings on the plugin status page? If you are missing the “MBString extension”, try installing it (or ask your server host, it’s pretty much a standard PHP extension) and see if that solves your issue.Let me know what you find & have a great day!
Ewout@jake2townz – were you able to fix this issue?
I realized that it could simply be a font thing too – if the font does not support your currency then the encoding will not change anything.Jake,
I’m closing this issue, but let me know if you need more help/pointers.have a great day!
EwoutI have the same problem.
I set the payment method (Bank Transfer) to my language (Thai, UTF-8) and the PDF display it in box character.All the status in Status page is in green.
I think it’s about the font.
Hello Orionmaster,
You are correct, with Thai, this is a font issue indeed!
Here’s some instructions for using custom fonts (these instructions are also part of the upcoming FAQ update):How can I use my own font?
Although the plugin supports webfonts, this is somewhat limited and has a lot of caveats, read this thread on the forum.
Some languages (Japanese, Chinese, etc.) are not supported by the default font included with the plugin, in this case a custom font is required.
The best method is to create a custom template first (see above), then add afonts/folder to that template and use the following code (replace the font names/filenames) to load the font in the style.css from the pdf template:<?php global $wpo_wcpdf;?> /* Load font */ @font-face { font-family: 'MyFont'; font-style: normal; font-weight: normal; src: local('MyFont'), local('MyFont'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont.ttf) format('truetype'); } @font-face { font-family: 'MyFont'; font-style: normal; font-weight: bold; src: local('MyFont Bold'), local('MyFont-Bold'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont-bold.ttf) format('truetype'); } @font-face { font-family: 'MyFont'; font-style: italic; font-weight: normal; src: local('MyFont Italic'), local('MyFont-Italic'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont-italic.ttf) format('truetype'); } @font-face { font-family: 'MyFont'; font-style: italic; font-weight: bold; src: local('MyFont Bold Italic'), local('MyFont-BoldItalic'), url(<?php echo $wpo_wcpdf->export->template_path; ?>/fonts/myfont-bolditalic.ttf) format('truetype'); }then make sure you assign that font family to the body or other elements of the template:
font-family: 'MyFont';Some notes:
- Only TTF fonts are supported.
- You can’t use numeric font weights (like 700 instead of bold)!
- Avoid spaces or special characters in the font filenames.
- I have found that not all servers cope well with the font paths. If this is the case with your font, try to put the font in the root of your site and put that in the font url (i.e.
url(http://yoursite.com/fonts/myfont-italic.ttf))
The topic ‘Changing PDF type to Unicode – is this possible?’ is closed to new replies.