Jump to content

Creating pdf files using PHP script


garrisonian14

Recommended Posts

Hi all,

 

I am using following code to create a pdf file and write some text in it using php.

 

$pdf = pdf_new();

pdf_open_file($pdf, "terms.pdf");

 

pdf_begin_page($pdf, 595, 842);

$arial = pdf_findfont($pdf, "Arial", "host", 1);

pdf_setfont($pdf, $arial, 10);

 

pdf_show_xy($pdf,"YES you are right", 50, 750);

pdf_end_page($pdf);

pdf_close($pdf);

 

But i get

Fatal error: Call to undefined function: pdf_new()

 

Can anybody please help me how to resolve  this, is there any special library needed to include or some settings in php.ini are required. Kindly guide me....

Urgent please.

 

Thanx,

 

Ali

Link to comment
https://forums.phpfreaks.com/topic/81327-creating-pdf-files-using-php-script/
Share on other sites

The pdf_new(); function is apart of the PECL pdflib library.  Have you installed this package?  If you have you may want to check your path setup in php.ini to make sure that you're pear and pecl directories are included.

 

Personally I found that FPDF is a bit more straight forward and easier to work with.  You may want to take a look at that library as an alternative.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.