1

I'm trying to output a pdf file with an italic text in Arial and using FPDI for that.

Since the arial.php and the arialbd.php (bold) are already existing, it's working fine. Now I found a ariali.ttf on the internet, which looks good when I open the overview of that font (little window with the quick brown fox sentence). But when I use the font in FPDI, it looks like this:

https://i.stack.imgur.com/muTN7.png

Does anybody know, how to fix this? Is it an ttf issue or where does that strange presentation come from?

Here my example code:

$pdf = new FPDI('P', 'mm', array(210, 297));
$pdf->SetAutoPageBreak(false);

$pdf->AddFont('Arial', 'I', 'ariali.php');
$pdf->AddFont('Arial', '', 'arial.php');

$pdf->AddPage();

$pdf->SetFont("Arial", "I", 16);
$pdf->SetXY(20,20);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(20,5,"This is an italic test text in Arial!");

$pdf->Output("test.pdf", "I");

EDIT:

test.pdf

Setasign's question gave me the hint to try to open the resulting PDF in another PDF viewer too than just in my browser (chromium on debian).

The GNOME document viewer Evince is showing a blank page and Adobe Acrobat on Windows is showing nice italic Arial text but giving the error (freely translated from German) "The embedded font "Arial-ItalicMT" could not be taken out. In certain circumstances, some characters won't be printed correctly"

I'm just using my example code and FPDI Version 1.4.4.

alexandre
  • 286
  • 3
  • 17

1 Answers1

0

The problem was the converter I used to generate the .php and the .z file from an .ttf file.

Always use the makefont scripts, shipped with fpdf/fpdi or use the online makefont: http://www.fpdf.org/makefont/

alexandre
  • 286
  • 3
  • 17