php - How to change the number in TCPDF for arabic & persian numbers -
how change number in tcpdf arabic & persian numbers, need change encoding or char codes?
i need replace 1
۱
, arabic code in unicode.
i find code,but not know how use it
function formatpagenumber($num) { $strnum = strval($num); $strnum = preg_replace_callback("/[0-9]/", create_function('$matches', ' $numarr = array("۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"); return $numarr[intval($matches[0])];'), $strnum); return $strnum; }
try this:
require_once('tcpdf/config/lang/eng.php'); require_once('tcpdf/tcpdf.php'); function formatpagenumber($num) { $strnum = strval($num); $strnum = preg_replace_callback("/[0-9]/", create_function('$matches', ' $numarr = array("۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"); return $numarr[intval($matches[0])];'), $strnum); return $strnum; } // create new pdf document $pdf = new tcpdf(pdf_page_orientation, pdf_unit, pdf_page_format, true, 'utf-8', false); // set font $pdf->setfont('dejavusans', '', 10); // add page $pdf->addpage(); // define html content style $html = formatpagenumber("this test string number 1724"); // output html content $pdf->writehtml($html, true, false, true, false, ''); // reset pointer last page $pdf->lastpage(); //close , output pdf document $pdf->output('test.pdf', 'i');
Comments
Post a Comment