elmas156 Posted March 31, 2012 Share Posted March 31, 2012 Hello everyone, I found a tutorial on creating a pdf with php and I just tried to create a basic pdf to see if it worked and modify it from there. Here is the link to the tutorial: http://www.astahost.com/info/tfclt-create-pdf-php-create-fly-pdf-web-server.html Well, after uploading the following php file to the server and testing it, I got this error: Fatal error: Call to undefined function pdf_new() in /home/caresa6/public_html/BubblyBounce.com/admin/pdftest.php on line 2 Here's the code that produced the error: <?php $mypdf = PDF_new(); PDF_open_file($mypdf, ""); PDF_begin_page($mypdf, 595, 842); $myfont = PDF_findfont($mypdf, "Times-Roman", "host", 0); PDF_setfont($mypdf, $myfont, 10); PDF_show_xy($mypdf, "Sample PDF, constructed by PHP in real-time.", 50, 750); PDF_show_xy($mypdf, "Made with the PDF libraries for PHP.", 50, 730); PDF_end_page($mypdf); PDF_close($mypdf); $mybuf = PDF_get_buffer($mypdf); $mylen = strlen($mybuf); header("Content-type: application/pdf"); header("Content-Length: $mylen"); header("Content-Disposition: inline; filename=gen01.pdf"); print $mybuf; PDF_delete($mypdf); ?> Can anyone help me figure out what to do from here? I have some PHP knowledge, but I'm treading in uncharted waters with this, so I am totally lost. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/260103-creating-pdf/ Share on other sites More sharing options...
spfoonnewb Posted March 31, 2012 Share Posted March 31, 2012 Did you follow the first half of the tutorial? It seems as though you are likely missing the required library. The phpinfo() function generates a html page with all the information about the PHP installation, including the information about the Apache web server, the version and settings of the PHP compiler, and the supplemental PHP libraries that are installed and activated. We have to check the pdf libraries. The results should look something like this: PDF Support: enabled PDFlib Gmbh Version: 5.0.3 Revision: $Revision: 1.112.2.11 $ Quote Link to comment https://forums.phpfreaks.com/topic/260103-creating-pdf/#findComment-1333117 Share on other sites More sharing options...
elmas156 Posted March 31, 2012 Author Share Posted March 31, 2012 I contacted my hosting provider tech support and they told me that pdf support was actually listed under "SPL," and that it was enabled. Not sure what SPL is, but that's what I was told. Anyone know anything about this. Just FYI, my hosting provider is Web Hosting Hub. Quote Link to comment https://forums.phpfreaks.com/topic/260103-creating-pdf/#findComment-1333118 Share on other sites More sharing options...
Drummin Posted April 1, 2012 Share Posted April 1, 2012 Did you do "Step 1" on this page to see if the PDF library is installed on your server? DO the check and If not contact your host. http://www.astahost.com/info/tfclt-create-pdf-php-create-fly-pdf-web-server.html Quote Link to comment https://forums.phpfreaks.com/topic/260103-creating-pdf/#findComment-1333192 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.