Jump to content

FPDF error: Undefined font


n1concepts

Recommended Posts

Hi,

 

I need to convert a web page to PDF but with specific fonts:  'futura xblk bt'  and      'Futura BdCn BT'

Note: I am using FPDF (www.fpdf.org)

 

Issue: if I use standard fonts like "Arial' or 'Times' the pdf renders without issues - displaying results.

However, if I edit the file - found at http://www.vonderborn.com/extended-tables-with-fpdf.php which is shown in one of the snippets below

 

<?
// create pdf
$pdf=new MYPDF('P','mm','A4');
$pdf->AliasNbPages();
$pdf->SetMargins($pdf->left, $pdf->top, $pdf->right); 
$pdf->AddPage();
   
// create table
$columns = array();      
   
// header col
$col = array();
$col[] = array('text' => 'Datum', 'width' => '20', 'height' => '5', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '8', 'font_style' => 'B', 'fillcolor' => '135,206,250', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => 'LTBR');
$col[] = array('text' => 'Text', 'width' => '125', 'height' => '5', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '8', 'font_style' => 'B', 'fillcolor' => '135,206,250', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => 'LTBR');
$col[] = array('text' => 'Soll', 'width' => '15', 'height' => '5', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '8', 'font_style' => 'B', 'fillcolor' => '135,206,250', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => 'LTBR');
$col[] = array('text' => 'Haben', 'width' => '15', 'height' => '5', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '8', 'font_style' => 'B', 'fillcolor' => '135,206,250', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => 'LTBR');
$col[] = array('text' => 'Saldo', 'width' => '15', 'height' => '5', 'align' => 'C', 'font_name' => 'Arial', 'font_size' => '8', 'font_style' => 'B', 'fillcolor' => '135,206,250', 'textcolor' => '0,0,0', 'drawcolor' => '0,0,0', 'linewidth' => '0.4', 'linearea' => 'LTBR');   
$columns[] = $col;
   
// Draw Table   
$pdf->WriteTable($columns);
   
// Show PDF   
$pdf->Output();
?> 

 

---------

 

I get the following error and can't figure out where to set the two specified fonts.

 

ERROR:

--------

FPDF error: Undefined font: futura xblk bt

 

===

 

Can someone advise how to set the font for those two: 'futura xblk bt'  and      'Futura BdCn BT'

Note: insertling in the above code (mapping to ''font_name' does not work).

 

Any help with this appreciated - thx!

Link to comment
https://forums.phpfreaks.com/topic/265851-fpdf-error-undefined-font/
Share on other sites

font_name in the array set the font to the fucntion 'SetFont()' in fpdf.php which is the default function file.

I found the answer - have to compile the file with makefont.php so it's recognizable by the library.

 

Your response was confusing but I appreciate the attempt to answer it - thx! :)

  • 2 years later...

Can you show me how to add a font to the makefont.php page.

 

When i go to makefont.php it is just a blank page.

And if i go to edit the makefont.php.. i have no clue what i would do.

 

I did go to

http://www.fpdf.org/makefont/

and it says to add the fonts.. but that also did not work.

 

Any help would really be appreacated.

Also i dont kow what encoding to use.

 

This is the font i am tryin to use on a signature line.

http://www.1001fonts.com/search.html?search=Mrs+Saint+Delafield&x=0&y=0

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.