pdflib greek problem
| From: | Thodoris | Date: | Fri, 27 Mar 2009 18:38:31 +0000 |
| Subject: | pdflib greek problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-290771@lists.php.net to get a copy of this message | ||
Hi,
I am trying the following code to generate a pdf:
try {
// Create a new pdf handler
$pdf = new PDFlib();
// open new PDF file
if ($pdf->begin_document("", "") == 0) {
die("Error: " . $p->get_errmsg());
}
// Set some info to the new pdf
$pdf->set_info("Creator", "Test");
$pdf->set_info("Author", "Test");
$pdf->set_info("Title", "Test");
// Start the page
$pdf->begin_page_ext(595, 842, "");
// Load the documents font and set the details
$font = $pdf->load_font("Times-Roman", "iso8859-7", "");
$pdf->setfont($font,24.0);
$pdf->set_parameter('autospace',TRUE);
// Set the position inside the document
$pdf->set_text_pos(50, 700);
// Now start to show the data
$str = 'Αυτό είναι ένα τεστ.';
mb_convert_variables('ISO-8859-7','UTF-8',$str);
$pdf->show($str);
// End the page and the document
$pdf->end_page_ext("");
$pdf->end_document("");
// Get the document from the buffer find it's length
$buf = $pdf->get_buffer();
$len = strlen($buf);
// And finally print it out to the browser
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=hello.pdf");
print $buf;
}
catch (PDFlibException $e) {
die("PDFlib exception occurred in hello sample:\n" .
"[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " .
$e->get_errmsg() . "\n");} catch (Exception $e) {
die($e);} Although greek are printed normally the characters are overlapping on each other. The script in encoded in UTF-8. Does anybody have any suggestions on this? Please any help would be appreciated. -- Thodoris