Forum Moderators: coopster
<?php
$pdf = pdf_new();
pdf_open_file ($pdf);
pdf_begin_page($pdf, 595, 842);
$font = pdf_findfont($pdf, "Times New Roman", "winansi", 1);
if ($font) {
pdf_setfont($pdf, $font, 10);
}
pdf_set_value($pdf, "textrendering", 1);
pdf_set_info ($pdf, "Author", "guide");
pdf_set_info ($pdf, "Keywords", "How, r, u");
pdf_show_xy($pdf, "A PDF document <B>created</B> in memory!", 50, 750);
pdf_show_xy($pdf, "A PDF document <B>created</B> in memory!", 50, 770);
pdf_show_xy($pdf, "A PDF document <B>created</B> in memory!", 50, 790);
pdf_show_xy($pdf, "A PDF document <B>created</B> in memory!", 50, 810);
pdf_show_xy($pdf, "A PDF document <B>created</B> in memory!", 50, 830);
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header("Content-type: application/pdf");
header("Content-disposition: inline; filename=test.pdf");
header("Content-length: " . strlen($data));
echo $data;
?>
But how to write images, links, colors, tables ( i.e., html elements ) into a .pdf file :¦
On the PHP PDF functions [php.net] page, you will find this note..
Note: If you're interested in alternative free PDF generators that do not utilize external PDF libraries, see this related FAQ [php.net].
The FPDF site has tutorials and working examples with a bunch of donated additions to accomplish most any task you wish.