Manoj Jadhav
Manoj Jadhav

Reputation: 1368

TCPDF UTF-8. INR symbols not showing

        tcpdf();
        $obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $obj_pdf->SetCreator(PDF_CREATOR);
        $obj_pdf->setPrintHeader(false);
        $obj_pdf->setPrintFooter(false);
        $obj_pdf->SetFont('dejavusans', '', 14, '', true);
        $obj_pdf->setFontSubsetting(false);
        //$obj_pdf->SetAutoPageBreak(true, 0);
        $obj_pdf->SetMargins(5, 5, 5,true);
        $obj_pdf->SetHeaderMargin(0);
        $obj_pdf->SetFooterMargin(0);
        $obj_pdf->AddPage();
        ob_start();

I am using below configuration but not able to generate INR symbol. It show "?" instead of INR symbol.

How can generate INR symbol?

Upvotes: 2

Views: 3024

Answers (2)

Vishnu Namboothiri K
Vishnu Namboothiri K

Reputation: 141

To view the symbol in TCPDF generated PDF's, it is necessary to use a font that supports the Indian Rupee Symbol. You may find such a font from the list at the page https://www.fileformat.info/info/unicode/char/20b9/fontsupport.htm.

Example:

DejaVu Sans supports displaying Indian Rupee fonts. Locate such a font from TCPDF fonts directory. If the name of the font is dejavusans, use it in the html to generate generate PDF.

<span style="font-family:dejavusans;">&#8377;</span>

Upvotes: 4

Lithin Kuriachan
Lithin Kuriachan

Reputation: 33

I had solved this issue with image instead of symbol.

$rupee_sym = '<img style="width:8px;" src="assets/images/rupee-indian.png" />';

And print it where you want:

echo $rupee_sym;

Hope this is helpful. :)

Upvotes: 0

Related Questions