尝试这个:
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 a page
$pdf->AddPage();
// define some HTML content with style
$html = formatPageNumber("This is my test string number 1724");
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// reset pointer to the last page
$pdf->lastPage();
//Close and output PDF document
$pdf->Output('test.pdf', 'I');