Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I display `₹` properly in pdf in Magento.?

Tags:

php

pdf

magento

Indian Rupee symbol(₹) is not displaying in invoice pdf in magento. In system->manage currency->symbols I save currency symbol as .

Then the pdf looks:

enter image description here

I change symbol in system->manage currency->symbols to ₹

Then the pdf looks like this:

enter image description here

How can I display properly in pdf(invoice,order etc) in Magento.?

like image 235
Deepu Sasidharan Avatar asked May 12 '15 11:05

Deepu Sasidharan


1 Answers

r4ven's and rajatsaurastri's answers helped me to find the solution. Thank you very much guys..

However I post the answer that make it working well..

1.Download the font that support Indian Rupee symbol. I download dejavu-sans font.

2.place the font in lib directory.

3.open app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php and app/code/core/Mage/Sales/Model/Order/Pdf/Items/Abstract.php

and replace

$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf');

with

$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/dejavu-sans/DejaVuSans.ttf');

(in _setFontRegular(), _setFontBold(), _setFontItalic() functions in both files.)

This link gives more info about changing the font.

like image 127
Deepu Sasidharan Avatar answered Sep 27 '22 20:09

Deepu Sasidharan