Page 1 of 1

generating a PDF file

Posted: Tue Jul 28, 2009 7:56 pm
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