Hello,
I have one mysql database named ddms and one table named district in there.
i am trying to retrieving data from my database in pdf using fpdf library of php.
my data is stored in utf-8 encoding and collation is utf8_general_ci.
data is in gujarati shruti font.
but whene i run php script it shows me something like this : સ૕રત
Kindly help me as soon as possible.
My code is :
define('FPDF_FONTPATH', 'font/');
require('fpdf/fpdf.php');
include "include/db_connection.php";
//create a FPDF object
$pdf=new FPDF();
//set font for the entire document
$pdf->AddFont('Shruti','I','shruti.php');
$pdf->SetFont('Shruti');
//$pdf->SetTextColor(50,60,100);
//set up a page
$pdf->AddPage('P');
$pdf->SetDisplayMode('default');
//insert an image and make it a link
$pdf->Image('images/logo.gif',100,10,20,0);
//display the title with a border around it
$pdf->SetXY(40,30);
$pdf->SetDrawColor(50,60,100);
$pdf->Write(10,'holiday master',0,'C',0);
$pdf->Line(10,40,200,40);
//Set x and y position for the main text, reduce font size and write content
$pdf->SetXY (20,45);
$pdf->SetFontSize(10);
$pdf->SetTextColor(30,30,100);
include "include/db_connection.php";
$sql="SELECT * FROM district";
$result = mysql_query($sql);
while($rows= mysql_fetch_array($result))
{
$dnm = $rows['distname'];
$pdf->SetXY (20,60);
$pdf->SetFontSize(12);
$pdf->SetTextColor(0,0,0);
$pdf->Write(7,$dnm);
$pdf->SetTextColor(0,0,0);
$pdf->Ln();
}
//Output the document
$pdf->Output('test.pdf','I');
?>