-
Step 1
Set up your website with the PHP processor so that all your PHP web pages will be processed through the PHP processor.
-
Step 2
Create a new web page with a PHP ending. You can use any html or text editor to do this.
-
Step 3
Obtain a class definition that defines the PDF layout and format, such as fpdf. This is a plain-text file that contains the PHP code to define a class. You could write this yourself, but the fpdf (free pdf) class file contains more than 1,700 lines of code, so getting one that's already been made for you is easier. Get this file and place it in the same directory as the PHP file you created in Step 2.
-
Step 4
Include the fpdf class files in your PHP web page with the "require" command:
require('fpdf.php'); -
Step 5
Set up your pdf object using the methods of the pdf class you have created. This will build the pdf file for you and display it in the browser. The exact methods may vary by class file, but will usually consist of creating a pdf object (new FPDF();) and displaying the object ($pdf->output;).













