Note that core font Helvetica-Bold does not accept font sizes>12 .
This probably affects other core fonts.
PDF_setfont
(PHP 4 >= 4.0.5, PECL pdflib >= 1.0.0)
PDF_setfont — フォントを設定する
説明
bool PDF_setfont
( resource $pdfdoc
, int $font
, float $fontsize
)
PDF_findfont() から返された font ハンドルを使用し、指定した size で現在のフォントを設定します。 成功した場合に TRUE を、失敗した場合に FALSE を返します。
PDF_setfont
info at techcare dot ch
14-Dec-2008 09:22
14-Dec-2008 09:22
pcheely at presensit dot com
24-Oct-2007 09:56
24-Oct-2007 09:56
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);
}
Malcolm Scott
05-Jun-2003 04:38
05-Jun-2003 04:38
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...
leea at digitus dot com dot au
31-Jan-2001 12:28
31-Jan-2001 12:28
Here is a link to a program which will convert your ttf fonts to afm format
http://www.freshmeat.net/projects/ttf2pt1/
shan at symbiotic dot 2y dot net
21-Dec-2000 07:21
21-Dec-2000 07:21
For those who are looking
the PDF core fonts Are
Courier,Courier-Bold,Courier-Oblique,Courier-BoldOblique,
Helvetica,Helvetica-Bold,Helvetica-Oblique,Helvetica-BoldOblique,
Times-Roman,Times-Bold,Times-Italic,Times-BoldItalic,
Symbol,ZapfDingbats
afsilva at netscape dot net
07-Nov-2000 04:04
07-Nov-2000 04:04
To anyone who is trying to add extra FONTS to work with PHP and pdflib.
Take a look at: ftp://ftp.adobe.com/pub/adobe/type/win/all/afmfiles/ - This is collection of fonts already converted to AFM. There are thousands of fonts. What I am doing is downloading everything, and then I will grep my way through the directories to find what I am looking for.
Another tip: to get the pdflib.upr file working with your fonts add:
putenv("PDFLIBRESOURCE=/dir/where/the/file/is/fonts/pdflib.upr");
on the beginning of your php script. And make sure you change the Font Definition entry on your pdflib.upr file as well. It needs to point to the directory where the .afm files are.
cox at idecnet dot com
31-Mar-2000 09:24
31-Mar-2000 09:24
There is also another encoding called 'host'. in the pdflib test examples, they say:
" We don't want to use metrics files for the sample, and therefore stick to host encoding. For this reason the sample text (which uses German special characters) must be platform-specific. Both flavors only differ in the special characters."
