Wplms-Pdf-Certificate: Tcpdf Utf-8 Bad Encoding With Special Characters Displays on Pdf File

If Something strange is happening with your pdf certificate, If you are using languages for pdf certificate like greek, Latin, Russian, Lithuanian, Turkish, Chinese etc. and while generating pdf certificate you get few of its characters and other remains special symbols like this ??????.

Then the question arises what should we do now??

TCPDF is quite tricky with utf8. Best way to achieve what you want is to embed the font in the generated PDF file itself. You can use FreeSerif/ OpenSans font from the TCPDF package, it contains all the utf-8 symbols, shows absolutely any character of any language. That’s probably the easiest way to get symbols you need.

You could also make your own font to embed, containing the characters you need. That’s probably the best solution, keeping it universal and small in size, but is more complex.


Follow the steps for Turkish language:

Freesans font download link: https://github.com/opensourcedesign/fonts/blob/master/gnu-freefont_freesans/FreeSans.ttf?raw=true

Here is the steps you need to follow:

  1. Download the font from above link Or upload your own fonts which support TrueType encoding with utf-8.
  2. Upload this custom font file (FreeSans.ttf) in your pdf certificate.
  3. Use the uploaded font for the certificate texts, when you generate certificate this time issue will be resolved.

Now it looks like this: http://prntscr.com/nh2b91


Follow the steps for the Russian language:

DejaVuSerif font download link: https://github.com/madhvendras84/DejaVuSerif/blob/master/dejavu-serif.zip

Here is the steps you need to follow:

  1. Download the font from the above link. Refer: http://prntscr.com/nlem8f
  2. Upload this custom font file (FreeSans.ttf) in your pdf certificate.
  3. Use the uploaded font for the certificate texts, when you generate certificate this time issue will be resolved.

Here is how it works: http://somup.com/cqhi1Mn45W

 


Follow the steps for the Arabic language:

aealarabiya font download link: https://github.com/madhvendras84/aealarabiya.ttf.git

Here are the steps you need to follow:

  1. Download the font from the above link. Refer: https://cl.ly/5237c1
  2. Upload this custom font file (aealarabiya.ttf) in your pdf certificate.
  3. Use the uploaded font for the certificate texts, when you generate certificate this time issue will be resolved.

Here is how it works: https://screencast-o-matic.com/watch/cq1YItTdyr



Follow the steps for the Chinese language:

AREALUNI font download link: https://github.com/madhvendras84/arealuni.ttf.git

Here are the steps you need to follow:

  1. Download the font from the above link. Refer: https://cl.ly/5237c1
  2. Upload this custom font file (AREALUNI.ttf) in your pdf certificate.
  3. Use the uploaded font for the certificate texts, when you generate certificate this time issue will be resolved.

Here is how it works: http://somup.com/cqQ0lKeEeW

results: http://prntscr.com/p9tjzi

Note: use exact font name as written in bold line else it will not work.

Was this article helpful?

Related Articles

Leave A Comment?