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

Indian Rupee symbol(₹) does not appear on the pdf invoice in magento . In the system-> manage currency-> symbols, I save currency symbol as .

Then looks pdf:

enter image description here

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

Then the PDF looks like this:

enter image description here

How can I correctly display in pdf (invoice, order, etc.) in magento .?

+5
source share
4 answers
The answers

r4ven and rajatsaurastri helped me find a solution. Thanks a lot guys ..

However, I am posting an answer that makes it work well.

1. Download a font that supports the Indian rupee symbol. I am downloading the font dejavu-sans .

2. Install the font in the lib directory.

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

and replace

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

from

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

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

This link provides more information about changing the font.

+7
source

can you check the local.xml file inside the application / etc, what encoding is there, if not, then try adding charset

 <charset>utf8</charset> 
+2
source

You need to use a font for your pdf that includes the Indian rupee symbol

+2
source

This solution is for Magento2.1.

we need to expand Magento \ Sales \ Model \ Order \ Pdf \ Invoice this. We cannot directly redefine AbstractPdf.php.

I created one module for this. You can download from here . It is working correctly.

0
source

All Articles