Latest News: (loading..)

Archived

This topic is now archived and is closed to further replies.

ikbel

euro sign in invoice pdf

5 posts in this topic

i use pdf_customer_invoice_v1.3, I use the euro sign and it is displayed without any errors. But as soon as a try to print a quote as a pdf, the euro-sign is replaced by € . (a strange couple of characters).

Share this post


Link to post
Share on other sites

finally i find the solution: replace $s=str_replace("\r",'',$txt); by $s=eregi_replace("€", chr(128), $txt); in fpdf.php

Share this post


Link to post
Share on other sites

A few problems there...

1) str_replace("\r",'',$txt) is getting rid of carriage return characters. What have you broken by eliminating that?

2) eregi_replace is a deprecated function and as soon as you go to PHP 5.3 you're going to get warnings. You should be using preg_replace.

3) chr(128) (x80) is applicable only to Windows-1252 character encoding (so-called "Smart Quotes" from Micro$oft). Beware of using it anywhere else, and make sure you know what character encodings are being used to create the PDF. As long as everything is consistent (the hard-coded Euro in the string, the replacement code, and what the PDF software is expecting), you're probably safe, but you'll be left twisting in the breeze if encodings change.

Share this post


Link to post
Share on other sites

@MrPhil, but what solution you could give to us, please? I'm not a php ninja coder per se and could it be awesome some help around here.

Share this post


Link to post
Share on other sites

For displaying a Euro sign, I would suggest defining the currency to be & euro; (close up the gap) rather than using a hard coded "binary" character code (128 or any other value/multibyte sequence). That will definitely work for osC page display; maybe it will work too for a PDF invoice, if its original source was HTML.

Share this post


Link to post
Share on other sites