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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.