PHP Classes

File: pdf_example/pdf_multiline_example.php

Recommend this page to a friend!
  Classes of Khaled Al-Shamaa   ArGlyphs   pdf_example/pdf_multiline_example.php   Download  
File: pdf_example/pdf_multiline_example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ArGlyphs
Convert Arabic text to Unicode for rendering
Author: By
Last change: Example show how to use new method in this class to get Arabic text with correct right alignment (Note, to download full set of examples please go to:
Date: 16 years ago
Size: 819 bytes


Class file image Download
@ini_set('zend.ze1_compatibility_mode', '1');

define('FPDF_FONTPATH', 'font/');

$pdf = new UFPDF();
$pdf->SetTitle('UFPDF is Cool.');
$pdf->SetAuthor('Khaled Al-Shamaa');

$pdf->AddFont('ae_AlHor', '', 'ae_AlHor.php');


$ArabicPDF = new ArGlyphs();

$filename = 'ajax.txt';
$handle = fopen($filename, 'r');
$text = fread($handle, filesize($filename));

$font_size = 16;
$chars_in_line = $ArabicPDF->a4_max_chars($font_size);
$total_lines = $ArabicPDF->a4_lines($text, $font_size);
$text = $ArabicPDF->convert($text, $chars_in_line);

$pdf->SetFont('ae_AlHor', '', $font_size);
$pdf->MultiCell(0, $total_lines, $text, 0, 'R', 0);