PHP

ID #397

Is there an alternative to pdflib?

Applies to: Grid System

Instead of using PDFlib, now commercial software, you can use FPDF (FreePDF), which allows you to generate PDF files without using the PDFlib library.

FPDF is installed in Modwest's PHP5 environment at /usr/share/php/fpdf. To get started using FPDF:

  1. Make sure that your include path in /conf/php.ini is set to /usr/share/php/
    include_path = "/usr/share/php/"
  2. Then, make sure to include the library file in your .php page:
    include('fpdf/fpdf.php');


As an example, create and put the following in /htdocs/www/mypdf.php:

AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
exit();
?>


Going to http://www.yourdomain.com/mypdf.php will now load a PDF in the browser with the text "Hello World!". If you have trouble, please refer to the FPDF FAQ and the FPDF tutorial.

Alternatives to using FPDF:

  1. Stay in Modwest's older RedHat 7 environment featuring PHP4 (not recommended), and use the formerly non-commerical version of PDFlib.
  2. Purchase a license to use the current version of PDFlib: http://www.pdflib.com/products/pdflib-family/buy-pdflib, and install it on your Modwest account by following the instructions here.

 


Last update: 2011-12-21 17:13
Author: FAQ Admin
Revision: 1.3

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 1 (1 Vote)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ

Comment of Anonymous:
For IE8 to download my PDF successfully, I had to follow the FAQ here, which explains how to disable the Acrobat plug-in: http://www.fpdf.org/en/FAQ.php#q3.

Then I had to open up IE8 and go to Tools >> Internet Options >> Custom Level >> and enable "Automatic prompting for file downloads" under the Downloads section. (All options under the Download section should be enabled.)
Added at: 2009-12-24 12:02