Page 305 - Open Soource Technologies 304.indd
P. 305
Unit 12: Portable Document Format
Notes
foreach($fonts as $f=>$embed)
{
$font = pdf_findfont($p,$f,”host”,$embed);
pdf_setfont($p,$font,25.0);
pdf_continue_text($p,”$f (“.chr(128).” Ç à á â ã ç è é ê)”);
}
pdf_end_page($p);
pdf_close($p);
$buf = pdf_get_buffer($p);
$len = strlen($buf); Header(“Content-Type: application/pdf”);
Header(“Content-Length: $len”);
Header(“Content-Disposition: inline; filename=hello_php.pdf”);
echo $buf; pdf_delete($p);
?>
The output of Example is shown in Figure 12.6.
Figure 12.6: Output of the Font Demonstration
12.4 Images and Graphics
Most PDF files contain some type of logo, diagram, illustration, or picture. It shows how to
include image files, build your own line-art illustrations, and repeat elements on every page
(for instance, a header with a logo).
LOVELY PROFESSIONAL UNIVERSITY 299