PHP 7.4.0RC4 Released!


(PHP 4 >= 4.0.5, PECL pdflib >= 1.0.0)

PDF_setfontStabilește fontul


PDF_setfont ( resource $pdfdoc , int $font , float $fontsize ) : bool

Stabilește fontul curent la mărimea fontsize, utilizând un handle font întors de PDF_load_font(). Întoarce valoarea TRUE în cazul succesului sau FALSE în cazul eșecului.

add a note add a note

User Contributed Notes 6 notes

pcheely at presensit dot com
11 years ago
Here is a simple function to ease changing fonts in your PDF.

function pdf_font($pdf,$size,$face='arial')
   //Set the path 
   ${$face} = $face."=$path/fonts/".$face.".ttf";

   pdf_set_parameter($pdf, 'FontOutline',${$face});
Malcolm Scott
16 years ago
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...
info at techcare dot ch
10 years ago
Note that core font Helvetica-Bold does not accept font sizes>12 .
This probably affects other core fonts.
shan at symbiotic dot 2y dot net
18 years ago
For those who are looking
the PDF core fonts Are

afsilva at netscape dot net
18 years ago
To anyone who is trying to add extra FONTS to work with PHP and pdflib.

Take a look at: - 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:
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
19 years ago
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."
To Top