English (United Kingdom)
Knowledge Base  >  Vik Booking  >  Invoices  >  Invalid characters in PDF

If the generation of the PDF files contains some invalid characters like ??? or unreadable strings, then it means that some multi-byte characters of your language are not supported by the default Font used by the PHP Class TCPDF for the generation of the PDF files. In fact, the default (PHP) Font used by TCPDF is a light-weight font called Helvetica, that doesn't support many multi-byte characters (accents, special letters etc..).

The solution to the problem is to use a different font that supports any characters of any languages. For example, the PDF font called Dejavusans will support multi-byte characters of most languages, but it's not included by default in Vik Booking due to its average weight of 5MB. The same thing goes for the PDF font called "cid0jp", which is perfect for Chinese and Japanese, but it weighs ~5MB. That's pretty much nothing for a web-server, but for the full package of the plugin VikBooking, such fonts would weigh more than the actual PHP source code and framework. Therefore, in order to keep the installer package light, only a basic font ships with the plugin.

There are two ways to "install" new PDF font files onto your website that will be used during the generation of the PDF files by our plugin: Manual File Upload or Custom WordPress Plugin. We strongly recommend to opt for the "Custom WordPress Plugin" solution so that future updates will not overwrite your custom PDF font files.

Solution #1 - Manual File Upload (strongly discouraged):

Please use THIS LINK to download the zip file containing the font Dejavusans and all its files. Unzip the archive, and inside it you will find a folder called "Dejavusans_PDF_Font". Open this folder, and you will find several files in different formats, exactly 63 files in total.

Upload via FTP all the 63 files onto the following directory of your server to "install" the new PDF font in Vik Booking:

/wp-content/plugins/vikbooking/site/helpers/tcpdf/fonts/

That's it. The next generation of a PHP file will be made by using the font Dejavusans, so long as the 63 files are uploaded onto the directory above.

Solution #2 - Custom WordPress Plugin (strongly recommended, but the plugin must be up to date):

Use THIS LINK to download the zip installer file for the WordPress plugin called "Vik Plugins TCPDF Fonts". The plugin loads some TCPDF official font files, and it declares a hook for VikBooking to load a specific font name. Either Dejavusans or will work fine for your language, but you are free to use this plugin even for a language that doesn't have multi-byte characters in case you would like to just use a better or different font for generating your PDF files.

Make sure to install and activate the plugin through the WordPress native functions, and then the next generation of a PDF document will be made by using the font specified in the source code of the plugin "Vik Plugins TCPDF Fonts".

Last Update: 2024-02-12
Helpful?
75% of people found this helpful.
This site uses cookies. By continuing to browse you accept their use. Further information