generating a PDF file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
skylines
Forum Newbie
Posts: 8
Joined: Tue Jul 28, 2009 2:45 am

generating a PDF file

Post by skylines »

Hi,

I am trying to create a PDF file and write sometext to it. i have the following code and i am getting error " Uncaught exception 'PDFlibException' with message 'Function must not be called in 'object' scope' in D:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\pdf.php:6\nStack trace:\n#0 D:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\pdf.php(6): pdf_setfont(Resource id #2, 0, 10)\n#1 {main}\n thrown in D:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\pdf.php on line 6".

can anyone pls help me here?.

<?php
$mypdf= PDF_new();
PDF_begin_document($mypdf,"KITTU.pdf");
PDF_begin_page_ext($mypdf,595,842);
$myfont = PDF_load_font($mypdf,"Times-Roman","host");
PDF_setfont($mypdf,$myfont,10);
PDF_show_xy($mypdf,"Sample PDF Created by PHP",50,750);
PDF_show_xy($mypdf,"Made with PDF libraries of PHP",50,730);
PDF_end_page($mypdf);
PDF_end_document($mypdf);
PDF_delete($mypdf);
?>

Thanks
Post Reply