Using Foreign Characters in Kalin’s PDF Creation Station


-- Download Using Foreign Characters in Kalin's PDF Creation Station as PDF --


The following are instructions for fixing font and character related problems such as foreign character sets in Kalin’s PDF Creation Station WordPress plugin.

First,  download the full version of TCPDF Engine. This is the same PDF engine that is included in Creation Station, except it has more fonts and other stuff I originally removed to conserve file size.

Now, extract the tcpdf folder to a workspace on your desktop. Go into the tcpdf/config folder and open tcpdf_config.php. In this file you can find some configuration variables that you can play with to adjust fonts, margins and whatnot. Find the line, define (‘PDF_FONT_NAME_MAIN’, ‘helvetica’); and, define (‘PDF_FONT_NAME_DATA’, ‘helvetica’); Now simply change ‘helvetica’ (or whatever font might be set) to whichever included font you’d like, such as ‘courier’, ‘times’, ‘dejavusans’, ‘freemono’ etc. You can look in the fonts folder to see which other fonts are available. There seems to be many different versions of the same fonts. Experiment until you find one that includes the character set you need. For example, using dejavusans seems to solve some issues with Turkish characters. (If you can’t find the font you like, you can visit the TCPDF website to see how to add new fonts. It’s a little more complicated and requires running some command-line functions. I haven’t personally tried it, but I’ve heard that it works. If you can’t figure it out, send me your font and I’ll give it a shot.)

Next, FTP into your server, find your wordpress/wp-content/plugins/kalins-pdf-creation-station/ directory. Copy your new tcpdf folder into the directory, overwriting the original tcpdf folder. (You might want to make a backup first to be safe.) Now you should be ready to go. Just start creating PDF files and check to make sure the characters show properly. Obviously you can keep re-uploading the tcpdf_config.php file to its appropriate location to test new fonts if you don’t have a local development environment.

Remember to make a local copy of your new tcpdf folder because you will need to re-upload it every time you upgrade the plugin.

Edit: somebody emailed me about this topic and wrote the following. I’m not sure what he’s talking about as it’s been a long time since I’ve looked into the code for these plugins, but here’s what he said. It sounds like it could be helpful.

hint: if somebody with the same problem contact you, it’s right that the font has to be changed to font with type ‘TrueTypeUnicode’ in order to know which one is the correct type, it is necessary to open the [font-name].php in text editor or php editor and check the properties of the font.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>