Page 297 - Open Soource Technologies 304.indd
P. 297
Unit 12: Portable Document Format
Notes
pdf_setfont($pdf,$font,38.0);
pdf_show_xy($pdf, “Bottom Left”, 10, 10);
pdf_show_xy($pdf, “Bottom Right”, 350, 10);
pdf_show_xy($pdf, “Top Left”, 10, 752);
pdf_show_xy($pdf, “Top Right”, 420, 752);
pdf_show_xy($pdf, “Center”,612/2-60,792/2-20);
pdf_end_page($pdf);
pdf_set_parameter($pdf, “openaction”, “fitpage”);
pdf_close($pdf);
$buf = pdf_get_buffer($pdf);
$len = strlen($buf);
header(“Content-Type: application/pdf”);
header(“Content-Length: $len”);
header(“Content-Disposition: inline; filename=coords.pdf”);
echo $buf; pdf_delete($pdf);
?>
The output of Example is shown in Figure 12.2.
Figure 12.2: Coordinate Demo Output
Top Left Top Right
Centre
Bottom Left Bottom Right
It can be inconvenient to use a bottom-left origin. Following Example puts the origin in the
top-left corner and displays a string near that corner.
LOVELY PROFESSIONAL UNIVERSITY 291