Posted: June 3, 2014 at 7:07 am
|
Hi support team, I am having a big problem with generating a PDF invoice. I use Czech language and need to generate invoice with “special characters” like ?š??žýá etc. But after I download this invoice, its without these characters – in fact, the text wont generate after the first character of these kind. Here is the example: http://prntscr.com/3p96kf // There should be 120 let inspirace Ba?ou and Nadace Tomáše Bati. Could you please help me with that? Thanks, Martin |
Hi Martin, I can show you an example of a code change for the invoice gateway folder’s template.php file that you can. One example is where it prints the attendee’s first and last name, which looks like this: $pdf->Cell(50, 5, pdftext($attendee_first . ' ' . $attendee_last), 0, 1, 'L'); //Set attendee name This can be changed to: $pdf->Cell(50,5,iconv("UTF-8", "ISO-8859-1",$attendee_first . ' ' . $attendee_last),0,1, 'L');//Set attendee name |
|
|
Josh, thanks for your tip. I am sorry but thats not working for me. I tried this tweak for more fields in PDF template and I still have the same problem. Is there any another option? Thanks, Martin |
Hi Martin, I am sorry, it should be: $pdf->Cell(50,5,iconv("UTF-8", "ISO-8859-2",$attendee_first . ' ' . $attendee_last),0,1, 'L');//Set attendee name The -1 is for German. -2 is for Czech. |
|
|
Thank you, this is helpful. But is not a complete solution. Now its look like this: http://prntscr.com/3pcw82 A should be: http://prntscr.com/3pcwfe I am sorry for complications but its important for us. Thanks for your help. |
|
Any tips for me? Its very important for us. We would like to launch our website including registrations today. Thank you. Martin |
Hi Martin, Sure, this is kind of tricky, but it may help. If you look at the FPDF homepage You’ll see that they say under What languages can I use?: The class can produce documents in many languages other than the Western European ones: Central European, Cyrillic, Greek, Baltic and Thai, provided you own TrueType or Type1 fonts with the desired character set. Chinese, Japanese and Korean are supported too. (I added the emphasis there) They also have a font file generator that you can use: There you can upload a font that you know has support for all the characters you need. Please be sure to set the encoding to ISO-8859-2 when you run the generator. In researching this I found a few stackexchange articles that have a few more tips: http://stackoverflow.com/a/10090800 (note that you can use the online generator instead) Here’s a recommendation to use the free Dejava font: http://stackoverflow.com/a/10740893 which you can download here: http://dejavu-fonts.org/wiki/Main_Page more info here: Finally, looking through the invoice gateway, I see that it’s only necessary to change the character encoding in one place (instead of throughout the invoice template file). If you open up function.pdf.php and scroll to the bottom, you can change the last little function there to read as: function pdftext($val){ return iconv("UTF-8", "ISO-8859-2",stripslashes_deep($val)); } |
|
|
Thank you, this solution looks nice. I have only one additional question. Where should I put the new font (folder and code)? Thank you very much, Martin |
The font files go into wp-content/plugins/event-espresso/class/fpdf/font |
|
|
Yes, I got it! Thank you for your help, now it works as we wanted (hope it will stay this way :)). Another, but not so important question – could I move currency symbol after the price? Not just in invoice PDF, but in all Event Espresso? Again, thanks, Josh. |
Hi Martin, It’s possible to move the currency symbol over to the other side of the price, but you would need to modify each of the templates and functions that display price. Most of the front-end display of prices gets loaded from the /templates folder. These can be copied over to /wp-content/uploads/espresso/templates and customized, but you’ll need to maintain the templates after updates. |
|
The support post ‘PDF invoice characters wont generate’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.