n1concepts Posted July 17, 2012 Share Posted July 17, 2012 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! Quote Link to comment https://forums.phpfreaks.com/topic/265851-fpdf-error-undefined-font/ Share on other sites More sharing options...
Mahngiel Posted July 17, 2012 Share Posted July 17, 2012 How are you setting the font? I don't see a reference to it. Do FPDF docs state any directions for font name declarations (you mentioned using _ so I assume that gave you cause)? Quote Link to comment https://forums.phpfreaks.com/topic/265851-fpdf-error-undefined-font/#findComment-1362289 Share on other sites More sharing options...
n1concepts Posted July 17, 2012 Author Share Posted July 17, 2012 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! Quote Link to comment https://forums.phpfreaks.com/topic/265851-fpdf-error-undefined-font/#findComment-1362293 Share on other sites More sharing options...
CFORA Posted September 24, 2014 Share Posted September 24, 2014 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 Quote Link to comment https://forums.phpfreaks.com/topic/265851-fpdf-error-undefined-font/#findComment-1491964 Share on other sites More sharing options...
ginerjm Posted September 24, 2014 Share Posted September 24, 2014 You have marked this as anwered - what was the answer? Quote Link to comment https://forums.phpfreaks.com/topic/265851-fpdf-error-undefined-font/#findComment-1491996 Share on other sites More sharing options...
Barand Posted September 24, 2014 Share Posted September 24, 2014 .. or the OP marked it as answered two years ago Quote Link to comment https://forums.phpfreaks.com/topic/265851-fpdf-error-undefined-font/#findComment-1492000 Share on other sites More sharing options...
ginerjm Posted September 24, 2014 Share Posted September 24, 2014 Haah!! Didn't even notice that. Quote Link to comment https://forums.phpfreaks.com/topic/265851-fpdf-error-undefined-font/#findComment-1492002 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.