Eirik Hoem recently pointed out two libraries that can be used in PHP to generate PDF files dynamically - FPDF and FPDI.
Ever wanted to generated PDF documents on the fly with PHP? Perhaps populate a standard contract with a customers name and address? FPDF and FPDI are two neat libraries which greatly helps when working with PDF files.
FPDF handles most of the work of creating and working with the PDF files while FPDI works together with it to pull in existing PDF files so FPDF can modify them. He links to some sample code you can try out once you've installed the two libraries.