PHP : Function Reference : PDF Functions : PDF_setfont
malcolm scott
Note that pdf_setfont (this function) and pdf_set_font (a deprecated function) are different. I spent a while trying to figure out why my code wasn't working; it turns out I'd included the extra underscore by accident...
pcheely
Here is a simple function to ease changing fonts in your PDF.
function pdf_font($pdf,$size,$face='arial')
{
//Set the path
$path=$_SERVER['DOCUMENT_ROOT'];
${$face} = $face."=$path/fonts/".$face.".ttf";
pdf_set_parameter($pdf, 'FontOutline',${$face});
$font=pdf_findfont($pdf,$face,"host",0);
pdf_setfont($pdf,$font,$size);
}
|