I personally like this package to create dynamic PDF files with PHP; however, the install instructions and documentation are horrible.
First of all, you need to have Pear installed
(open a cmd window on your server and run go-pear.bat from your PHP install directory)
Next to get File_PDF installed and working:
1. open a cmd window on your server
2. type: pear channel-update pear.php.net (hit enter)
3. type: pear upgrade-all (hit enter)
4. type: pear install HTTP_Download-1.1.3 (hit enter)
5. type: pear install File_PDF-0.3.2 File_PDF (hit enter)
That should get File_PDF installed along with all the upgraded dependencies
Now some code example:
-
-
<?php
-
require (‘File/PDF.php’);
-
$p = &File_PDF::factory(‘P’, ‘mm’, ‘A4′);
-
$p->open();
-
$p->setMargins(50, 50);
-
$p->addPage(‘P’);
-
$p->setFont(‘arial’, ”, 15);
-
$p->write(10, ‘This is some text’);
-
$p->text(10, 20, ‘Hello’);
-
$p->close();
-
$p->output(‘hello.pdf’);
-
?>
-
Enjoy!






